Skip to content

Instantly share code, notes, and snippets.

@giripriyadarshan
Created March 8, 2021 07:56
Show Gist options
  • Save giripriyadarshan/c2f7ce959a388eac0d3891ceb7ec94d6 to your computer and use it in GitHub Desktop.
Save giripriyadarshan/c2f7ce959a388eac0d3891ceb7ec94d6 to your computer and use it in GitHub Desktop.
CPU intensive version of delay(int ms) using millis()
void msDelay(int ms)
{
unsigned long pl = millis();
while (1) // infinite loop
{
if ((millis() - pl) > ms) // if certain delay trigger
break;
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment