Waiting and timing: delay(), delayMicroseconds(), millis() and micros(). More...
Functions | |
| delay (ms) | |
| Waits a number of milliseconds. | |
| delayMicroseconds (us) | |
| Waits a number of microseconds. | |
| millis () | |
| Milliseconds since the board started. | |
| micros () | |
| Microseconds since the board started. | |
Waiting and timing: delay(), delayMicroseconds(), millis() and micros().
| delay | ( | ms | ) |
Waits a number of milliseconds.
The rest of your code waits too; a tone() or analogWrite() carries on. Fractions of a millisecond are dropped.
| ms | Milliseconds. |
| delayMicroseconds | ( | us | ) |
Waits a number of microseconds.
Each call takes about 60 us longer than asked: the time MicroPython needs to make the call. So it suits waits of about 100 us and up; for whole milliseconds use delay().
| us | Microseconds. |
| millis | ( | ) |
Milliseconds since the board started.
Counts from power-up or RESET; a soft reset (e.g. mpremote soft-reset) doesn't restart it. Never wraps round, as long as it is called at least every 6 days. Use it to time things without stopping your code.
| micros | ( | ) |
Microseconds since the board started.
Counts from the same start as millis(). Never wraps round, as long as it is called at least every 8 minutes. The call itself takes tens of us.