Blink Without delay Using millis
Track elapsed time to run tasks on schedule.
A Built-in Stopwatch
The millis function returns how many milliseconds your board has been running since it powered on. It is a free, always-counting stopwatch. ⏱️
unsigned long now = millis();Why unsigned long
Store millis in an unsigned long. The count grows huge over time, and a plain int would overflow in under a minute.
All lessons in this course
- int, float, bool on Arduino
- Why delay() Blocks Everything
- Blink Without delay Using millis
- Run Two Things at Once