Timer1 Library

Arduino page for it here. Download from here or just install TimerOne using the Arduino libraries manager Using the Timer 1 Library For a Simple IRQ Timer

Read More

Heartbeat Timer

A Example Heartbeat Timer In your apps main loop HeartbeatTimer(); The Heartbeat Function //******************************* //******************************* //********** HEARTBEAT ********** //******************************* //******************************* void HeartbeatTimer() { static byte heartbeat_10ms_timer = 0; static byte heartbeat_100ms_timer = 0; static unsigned long heartbeat_last_1ms_time = 0; while ((micros() – heartbeat_last_1ms_time) >= 1000) //micros() provides exact 1mS timing, millis() does not! { //——————————- […]

Read More

Arduino Timers

millis() Continuous running mS timer.  Rolls over back to zero. unsigned long In our test millis did not provide exact 1mS timing, whereas using micros x 1000 did. micros() Continuous running unsigned long uS timer.  Rolls over back to zero. unsigned long

Read More

Delay

Delay 1 cycle A nop instruction, allowing you to waste one cycle (62.5ns on a 16MHz Arduino) is created using this inline assembly: Or can be made into a define using this: Delay mS Value is unsigned long, so up to 4,294,967,295 (32-bit) Delay uS Value is unsigned int. Delay nS Supported by some boards

Read More