// See if you can write a script that flashes 1 LED at 3Hz,
// flashes a second at 45bpm & then makes the third LED switch
// between copying LED1 & LED2 every 15 seconds
#include <blinker.h>
blinker LED1(2,100,333.333); // red
blinker LED2(3,100,1333.333); // green
const int LED3 = 4; // blue
timeObj timer(15 * 1000);
bool follow1;
void setup() {
LED1.setPercent(50);
LED2.setPercent(50);
LED1.setOnOff(true);
LED2.setOnOff(true);
pinMode(LED3,OUTPUT);
follow1 = true;
}
void loop() {
idle();
if (timer.ding()) {
follow1 = !follow1;
timer.stepTime();
}
if (follow1) {
digitalWrite(LED3,LED1.pulseHiLow());
} else {
digitalWrite(LED3,LED2.pulseHiLow());
}
}