#include "millisDelay.h"
int led1 = 2;
int led2 = 3;
// Pin 13 has an LED connected on most Arduino boards.
bool led1On = false; // keep track of the led state
bool led2On = false; // keep track of the led state
millisDelay led_1_Delay;
millisDelay led_2_Delay;
void setup()
{
// initialize the digital pin as an output.
pinMode(led1, OUTPUT); // initialize the digital pin as an output.
pinMode(led2, OUTPUT); // initialize the digital pin as an output.
// start delay
led_1_Delay.start(700);
led_2_Delay.start(5000);
}
void loop()
{
// check if delay has timed out
if (led_1_Delay.justFinished())
{
led_1_Delay.repeat(); // start delay again without drift
// toggle the led
led1On = !led1On;
digitalWrite(led1, led1On);
}
if (led_2_Delay.justFinished())
{
led_2_Delay.repeat(); // start delay again without drift
// toggle the led
led2On = !led2On;
digitalWrite(led2, led2On);
}
}