// Joystick - Version: Latest

#include <Adafruit_NeoPixel.h>
#include <mechButton.h>
#include <neoPixel.h>


neoPixel theLEDs(14,3);  // Global pixel string.


// My button class..
class greenButton : public mechButton {

  public:
            greenButton(int inPin,int inLED);
  virtual   ~greenButton(void);

  virtual   void  takeAction(void);   // Something for the Pro's to inherit.

            int   LEDNum;

};


// Constructor.
greenButton::greenButton(int inPin,int inLED)
  : mechButton(inPin) { LEDNum = inLED; }


// Destructor. (Does nothing)
greenButton::~greenButton(void) { }

// We been clicked!! Do something.
void greenButton::takeAction(void) {

  if (trueFalse()) {
    theLEDs.setPixelColor(LEDNum,&green);
  } else {
    theLEDs.setPixelColor(LEDNum,&red);
  }
  theLEDs.show();
}


// Our button objects..
greenButton btn1(12,0);
greenButton btn2(11,1);
greenButton btn3(10,2);
greenButton btn4(9,3);
greenButton btn5(8,4);
greenButton btn6(7,5);
greenButton btn7(6,6);

greenButton btn8(23,7);
greenButton btn9(25,8);
greenButton btn10(27,9);
greenButton btn11(29,10);
greenButton btn12(31,11);
greenButton btn13(33,12);
greenButton btn14(35,13);


// Our setup.
void setup(void) {
  
  btn1.hookup();  // Hook up all the idlers.
  btn2.hookup();
  btn3.hookup();
  btn4.hookup();
  btn5.hookup();
  btn6.hookup();
  btn7.hookup();

  btn8.hookup();  // Hook up all the idlers.
  btn9.hookup();
  btn10.hookup();
  btn11.hookup();
  btn12.hookup();
  btn13.hookup();
  btn14.hookup();

  theLEDs.begin();  // Fire up the LEDS.
  theLEDs.setAll(&green);
  theLEDs.show();
}

// Run!
void loop(void) { idle(); }