// Setup an LED to blink from 1/2 hz to 6 hz controled by a POT. 
// Along with the intermediate frequenciies. Just doing the
// endpoints won't cut it.

#include <blinker.h>
#include <autoPOT.h>
#include <mapper.h>

blinker   theBlinker(3);
autoPOT   potManager(A0);
mapper    pot2Hz(0,1023,0.5,6); // Slow blinks because wokwi can't do fast.

void setup() {

  Serial.begin(115200);
  theBlinker.setOnOff(true);
  potManager.setCallback(valueChange);
}

void valueChange(int newValue) {

  float hrz;
  float ms;

  hrz = pot2Hz.map(newValue);
  Serial.println(hrz);
  ms = 1000.0/hrz;
  theBlinker.setPeriod(ms);
  theBlinker.setPercent(50);
}

void loop() { idle(); }