#include "blinker.h"
#include "mechButton.h"


mechButton  theButton(2);
blinker     aBLinker;             
timeObj     runTimer(10000.0);   // 10 seconds.


void setup() {

   // Fire it up.
   aBLinker.setPeriod(2000);           // 1 sec on, 1 sec off.
   aBLinker.setPercent(50);            // 50:50 on off.
   theButton.setCallback(butnClk);     // Do this when the button changes.
}


void butnClk(void) {

   if (!theButton.getState()) {
      runTimer.start();
      aBLinker.setOnOff(true);
   }
}


void loop() {
   
   idle();
   if (aBLinker.running() && runTimer.ding()) {
         aBLinker.setOnOff(false);
   }
}