Created
March 8, 2021 07:56
-
-
Save giripriyadarshan/c2f7ce959a388eac0d3891ceb7ec94d6 to your computer and use it in GitHub Desktop.
CPU intensive version of delay(int ms) using millis()
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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