Download this file
#include "blinker.h"

bool Blinker::canRun(uint32_t now) {
  return enabled && (int32_t) (runTime - millis()) < 0;
}

void Blinker::start(uint8_t r) {
  rate = r;
  setRunTime(millis());
  enabled = true;
}

void Blinker::stop() {
  enabled = false;
  digitalWrite(LED_PIN, HIGH);
}
  
void Blinker::run(uint32_t now) {
  light_on = !light_on;
  digitalWrite(LED_PIN, light_on);
  incRunTime(rate*100);
}

// vim:ft=arduino