/****************************************************
  EIGHT BUTTONS EXAMPLE:
  An example that checks the status of eight buttons.
  All input pins will have their pullups enabled.
  The LED blinks for each on press transition.
  ***************************************************/

#include <Toggle.h>

const byte num = 8; // number of buttons
const byte pin[num] = {2, 3, 4, 5, 6, 7, 8, 9}; //button pins
const byte ledPin = LED_BUILTIN;
const unsigned int blinkMs = 100; // led blink duration (ms)

Toggle *sw = new Toggle[num];

void setup() {
  for (int i = 0; i < num; ++i) {
    sw[i].begin(pin[i]);
    sw[i] = pin[i];
  }
}

void loop() {
  byte ledState = num;
  for (int i = 0; i < num; i++)  {
    sw[i].poll();
    if (sw[i].blink(blinkMs)) {
      ledState++;
    } else {
      ledState--;
    }
  }
  digitalWrite(ledPin, ledState);
}
uno:A5.2
uno:A4.2
uno:AREF
uno:GND.1
uno:13
uno:12
uno:11
uno:10
uno:9
uno:8
uno:7
uno:6
uno:5
uno:4
uno:3
uno:2
uno:1
uno:0
uno:IOREF
uno:RESET
uno:3.3V
uno:5V
uno:GND.2
uno:GND.3
uno:VIN
uno:A0
uno:A1
uno:A2
uno:A3
uno:A4
uno:A5
btn1:1.l
btn1:2.l
btn1:1.r
btn1:2.r
btn2:1.l
btn2:2.l
btn2:1.r
btn2:2.r
btn3:1.l
btn3:2.l
btn3:1.r
btn3:2.r
btn4:1.l
btn4:2.l
btn4:1.r
btn4:2.r
btn5:1.l
btn5:2.l
btn5:1.r
btn5:2.r
btn6:1.l
btn6:2.l
btn6:1.r
btn6:2.r
btn7:1.l
btn7:2.l
btn7:1.r
btn7:2.r
btn8:1.l
btn8:2.l
btn8:1.r
btn8:2.r