// To compile this you will need to install
// LC_baseTools from the library manager.

#include <mechButton.h>


#define A_PIN	2     // Pins we'll hook the buttons to.
#define B_PIN	3     // The other side hooks to ground.
#define C_PIN	4
#define D_PIN	5
#define E_PIN	6


mechButton aButton(A_PIN);  // Set button A to pin A_PIN.
mechButton bButton(B_PIN);  // Set button B to pin B_PIN.
mechButton cButton(C_PIN);  // You get the idea..
mechButton dButton(D_PIN);
mechButton eButton(E_PIN);


// Your standard sketch setup()
void setup() {
   
  Serial.begin(9600);              // Fire up our serial monitor thing.
  aButton.setCallback(aCallback);  // Set up our callback. (Also calls hookup() for idling.)
  bButton.setCallback(bCallback);  // And each to his own..
  cButton.setCallback(cCallback);
  dButton.setCallback(dCallback);
  eButton.setCallback(eCallback);
}


// This is the guy that's called when the A button changes state.
void aCallback(void) {

   Serial.print("A Button just became ");
   if (aButton.getState()) {
      Serial.println("true!");
      //Keyboard.release(keyValueA);
   } else {
      Serial.println("false!");
      //Keyboard.press(keyValueA);
   }
}

// This is the guy that's called when the B button changes state.
void bCallback(void) {

   Serial.print("B Button just became ");
   if (bButton.getState()) {
      Serial.println("true!");
      //Keyboard.release(keyValueB);
   } else {
      Serial.println("false!");
      //Keyboard.press(keyValueB);
   }
}

// This is the guy that's called when the A button changes state.
void cCallback(void) {

   Serial.print("C Button just became ");
   if (cButton.getState()) {
      Serial.println("true!");
      //Keyboard.release(keyValueC);
   } else {
      Serial.println("false!");
      //Keyboard.press(keyValueC);
   }
}

// This is the guy that's called when the A button changes state.
void dCallback(void) {

   Serial.print("D Button just became ");
   if (dButton.getState()) {
      Serial.println("true!");
      //Keyboard.release(keyValueD);
   } else {
      Serial.println("false!");
      //Keyboard.press(keyValueD);
   }
}

// This is the guy that's called when the A button changes state.
void eCallback(void) {

   Serial.print("E Button just became ");
   if (eButton.getState()) {
      Serial.println("true!");
      //Keyboard.release(keyValueE);
   } else {
      Serial.println("false!");
      //Keyboard.press(keyValueE);
   }
}


// Your standard sketch loop()
void loop() {
   
   idle();  // Let all the idlers have time to do their thing.
}