/*
different blink rhythm for LEDs
https://forum.arduino.cc/t/changing-this-code-to-work-in-milliseconds-instead-of-seconds/1305833
*/
//slightly different includes for the simulator
#include "Noiasca_led.h" // download library from http://werner.rothschopf.net/microcontroller/202202_tools_led_en.htm
#include "Noiasca_discrete.h" // use the discrete pins on the Arduino/Microcontroller
RhythmPin rhythmLed[] {8, 9, 10, 13, 6}; // create several LED objects, each has an individuel discrete Arduino pin
void setup() {
for (auto &r : rhythmLed) r.begin(); // you have to call the .begin() method for the LED
// on off on off on off
rhythmLed[0].setInterval(1000, 4000, 2000, 2000, 2000, 3000); // this LED starts with a OFF phase, hence the first ON phase is 0 ms
rhythmLed[1].setInterval(500, 2000, 2000, 2000, 2000, 5000);
rhythmLed[2].setInterval(1000, 1000, 2000, 1500, 2000, 6000);
rhythmLed[3].setInterval(1000, 2000);
rhythmLed[4].setInterval(2000, 2000);
}
void loop() {
uint32_t currentMillis = millis();
for (auto &r : rhythmLed) r.update(currentMillis); // you have to call update() for each LED, as the objects are in array you can loop through this array with a "auto range based for loop"
}
//