This is the multi-page printable view of this section. Click here to print...

Return to the regular view of this page

As of 2025-08-01

System Functions

Functions for handling time and random numbers

1 - millis()

Get system time
Gets the system time in milliseconds.
uint32_t millis()

The system time is updated by TickTimer interrupts.

2 - delay()

Delay processing
Performs a delay using polling.
void delay(uint32_t ms)

Performs a delay for the period specified by ms.

Time measurement is done using the TickTimer count. When a long delay is specified, the CPU clock is reduced during the polling process.

3 - delayMicroseconds()

Delay processing (microseconds)
Performs a delay using polling (specified in microseconds).
void delayMicroseconds(uint32_t microsec)

Performs a delay for the duration specified by microsec.

Time measurement is done using the TickTimer count. When a long delay is specified, the CPU clock is reduced during polling.

4 - random()

Random number generation
Generates a random number.
uint32_t random(uint32_t maxval)
uint32_t random(uint32_t minval, uint32_t maxval)

The first function returns a value in the range 0..(maxval-1). Note that the value of maxval is not the maximum value itself.

The second function returns a value in the range minval..maxval-1.