#include "blinker.h"
#include "mapper.h"

// So everyone wants newbies to write blink without delay. This is good
// because delay() is bad. Well, here's the simple way to do it..
// Allocate a global blinker object.
blinker aBLinker;             
mapper  POTToMsMapper(0,1023,500,1000);    // Change to 0.5,1.0 for actual values.

void setup() {

   // Fire it up.
   aBLinker.setOnOff(true);
}


void loop() {
  
  int   POTReading;
  float POTValueMapped;

  idle();                                           // Runs square wave.
  POTReading = analogRead(A0);                      // Grab raw reading.
  POTValueMapped = POTToMsMapper.map(POTReading);   // Map reading to period.
  aBLinker.setPeriod(POTValueMapped);               // Set the freq.
  aBLinker.setPercent(50);                          // Make this 50% on/off wave.
}