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

#define RED_PIN   A0
#define GREEN_PIN A1
#define BLUE_PIN  A2


neoPixel    theLEDs(8,2);
mapper      potMapper(0,1023,0,255);
mechButton  showMeBtn(3);
int         redVal;
int         greenVal;
int         blueVal;

void setup() {
  
  Serial.begin(115200);
  Serial.println("Click the button to see the current (0..255) RGB values.");
  showMeBtn.setCallback(showMeClk);
  theLEDs.begin();
  pinMode(9,OUTPUT);
  pinMode(10,OUTPUT);
  pinMode(11,OUTPUT);
}   
  
void showMeClk(void) {

  if (!showMeBtn.getState()) {
    Serial.print("Current R,G,B values : ");
    Serial.print(redVal);Serial.print(",\t");
    Serial.print(greenVal);Serial.print(",\t");
    Serial.println(blueVal);
  }
}


void loop() {

  
  colorObj  theColor;

  idle();
  redVal = round(potMapper.map(analogRead(RED_PIN)));
  greenVal = round(potMapper.map(analogRead(GREEN_PIN)));
  blueVal = round(potMapper.map(analogRead(BLUE_PIN)));
  theColor.setColor(redVal,greenVal,blueVal);
  theLEDs.setAll(&theColor);
  theLEDs.show();
  analogWrite(11,redVal);
  analogWrite(10,greenVal);
  analogWrite(9,blueVal);
}
Red
Green
Blue
Set a color you like, click the button for the RGB values.