skip navigational linksPJRC
Shopping Cart Checkout Shipping Cost Download Website
Home Products Teensy Blog Forum
You are here: Teensy Teensyduino Timing Functions

PJRC Store
Teensy 3.6, $29.25
Teensy 3.5, $24.25
Teensy 3.2, $19.80
Teensy LC, $11.65
Teensy 2.0, $16.00
Teensy++ 2.0, $24.00
Main Page
Getting Started
How-To Tips
Code Library

Timing Functions

Several functions are available to help you control the timing or speed your program performs its actions.

This table can help you choose the appropriate feature.

FeatureSummaryTypical UsesGotchas
delay() Wait: 1 ms to 49.7 days Simple programs, easiest to use Can't do anything while waiting
Metro Library Recurring timing functions Schedule work at regular intervals Must repetitively call check() function
Variables that automatically increment General purpose: scheduling work, timeout waiting for input, etc. Variables must be outside functions. Avoid compare equals.
delayMicroseconds() Wait: 1 µs to 16 ms Short delays for hardware response Interrupts can lengthen delay
Time since your code began General purpose Math & rollover handling required
IntervalTimer Function called at regular intervals Accessing hardware with precise timing Advanced interrupt programming is required
Time Library
TimeAlarms Lib.
Date & Time Keeping track of calendar time Extra hardware required to retain while power is off.