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 void 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! { //——————————- //—– HEARTBEAT EVERY […]

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: __asm__ __volatile__ ("nop\n\t"); Or can be made into a define using this: #define NOP __asm__ __volatile__ ("nop\n\t") Delay mS delay(1000); //Time in mS   Value is unsigned long, so up to 4,294,967,295 (32-bit)

Read More