Reference millis()

millis()

Returns the number of milliseconds since a sketch started running.

millis() keeps track of how long a sketch has been running in milliseconds (thousandths of a second). This information is often helpful for timing events and animations.

If a sketch has a setup() function, then millis() begins tracking time before the code in setup() runs. If a sketch includes a preload() function, then millis() begins tracking time as soon as the code in preload() starts running.

Examples


Related References