// Endless Blink timer example.
// I was just relaxed and like the question mark looking
// wiring. This does not do anything execept blink a led for
// five seconds and count minutes.
//
// So, everyone wants newbies to write blink without delay. This is good,
// because delay() is bad. Well, here's a simple way to do it..
// Have fun!
// 
// Just for fun, i'll make a Endless blink timer.
//
// Created by jim lee, 
// https://github.com/leftCoast/LC_baseTools/tree/master/examples/blinkWithoutDelay_2
//
// modified by Edoctoor Feb 1, 2022
// 

#include "blinker.h"

// optional blinker attributes.
#define BLINK_PERIOD  60000  // Ms, period/cycle is 60000 1 minute
#define BLINK_LIT     5000  // ms, stay on for 5000 = 5 second
#define PIN_1         10    // Pin NUM // One oclock
#define PIN_2         12    // Pin NUM // Two oclock
#define PIN_3         13    // Pin NUM // Three oclock
#define PIN_4         11    // Pin NUM // Four oclock
#define PIN_5         9     // Pin NUM // Five oclock
#define PIN_6         6     // Pin NUM // Six oclock
#define PIN_7         5     // Pin NUM // Seven oclock
#define PIN_8         4     // Pin NUM // Eight oclock
#define PIN_9         2     // Pin NUM // Nine oclock
#define PIN_10        3     // Pin NUM // Ten oclock
#define PIN_11        7     // Pin NUM // Eleven oclock
#define PIN_12        8     // Pin NUM // Twelve oclock



// Allocate a global blinker object with attributes.
blinker aBlinker(PIN_1,  BLINK_LIT, BLINK_PERIOD); 
blinker bBlinker(PIN_2,  BLINK_LIT, BLINK_PERIOD); 
blinker cBlinker(PIN_3,  BLINK_LIT, BLINK_PERIOD); 
blinker dBlinker(PIN_4,  BLINK_LIT, BLINK_PERIOD); 
blinker eBlinker(PIN_5,  BLINK_LIT, BLINK_PERIOD); 
blinker fBlinker(PIN_6,  BLINK_LIT, BLINK_PERIOD); 
blinker gBlinker(PIN_7,  BLINK_LIT, BLINK_PERIOD); 
blinker hBlinker(PIN_8,  BLINK_LIT, BLINK_PERIOD); 
blinker iBlinker(PIN_9,  BLINK_LIT, BLINK_PERIOD); 
blinker jBlinker(PIN_10, BLINK_LIT, BLINK_PERIOD); 
blinker kBlinker(PIN_11, BLINK_LIT, BLINK_PERIOD); 
blinker lBlinker(PIN_12, BLINK_LIT, BLINK_PERIOD); 

long int minutes = 1;

void setup() {

  // fire it up.
  aBlinker.setOnOff(true);
  sleep(5000);                    // 5000 = 5 seconds
  bBlinker.setOnOff(true);
  sleep(5000); 
  cBlinker.setOnOff(true);
  sleep(5000); 
  dBlinker.setOnOff(true);
  sleep(5000); 
  eBlinker.setOnOff(true);
  sleep(5000); 
  fBlinker.setOnOff(true);
  sleep(5000); 
  gBlinker.setOnOff(true);
  sleep(5000); 
  hBlinker.setOnOff(true);
  sleep(5000); 
  iBlinker.setOnOff(true);
  sleep(5000); 
  jBlinker.setOnOff(true);
  sleep(5000); 
  kBlinker.setOnOff(true);
  sleep(5000); 
  lBlinker.setOnOff(true);
  sleep(5000); 

  // Note: Setup takes one whole minute because of all the sleeps.

  Serial.begin(115200);
}


void loop() {

  // blinker is an idler. Calling idle() once in the loop lets ALL idlers run.
  idle();

  // Example of how sleep(); doesn't not affect blinker nor mechButton
  // Use sleep instead of delay from now on; sleep does not pause idle()
  Serial.print(minutes);
  Serial.println(" minutes");
  minutes++;
  sleep(60000);               // 60000 = 1 minute
}