I'm trying to write a sketch to blink some LEDs without using the delay function (because I want to be able to change the blink times using MegunoLink). A simplified version of my sketch is:
#include "ArduinoTimer.h"
ArduinoTimer Timer1;
void setup() {
pinMode (LED_BUILTIN, OUTPUT);
digitalWrite(LED_BUILTIN, LOW);
}
void loop() {
if (Timer1.TimePassed_Milliseconds(2000))
digitalWrite(LED_BUILTIN, HIGH);
if (Timer1.TimePassed_Milliseconds(1000))
digitalWrite(LED_BUILTIN, LOW);
}
The way this is written the LED never comes on because the 1000 ms time for LOW is shorter than the HIGH time. (I want the LED on for 2 sec and off for 1 sec.)
Any suggestions will be appreciated.