#include <blinker.h>
#include <mechButton.h>
#define LED_PIN1 3
#define LED_PIN2 4
#define BTN_PIN 2
blinker LEDBlinker(LED_PIN1,300,600); // A blinking object.
mechButton ourBtn(BTN_PIN); // A button debouncer.
void setup() {
pinMode(LED_PIN2,OUTPUT);
}
void loop() {
idle(); // idle() lets the magic happen.
LEDBlinker.setOnOff(!ourBtn.trueFalse()); // Bink if the button is pressed.
if (LEDBlinker.running()) {
digitalWrite(LED_PIN2,!LEDBlinker.pulseHiLow());
} else {
digitalWrite(LED_PIN2,false);
}
// DO whatever else you want here. NO BLOCKING!
}