#include //neopixel pins// int Power = 11; int NEOPIN = 12; #define NUMPIXELS 1 Adafruit_NeoPixel pixels(NUMPIXELS, NEOPIN, NEO_GRB + NEO_KHZ800); //pins for each led color// int REDled = 1; int GREENled = 26; int BLUEled = 0; //analog pins for the potenciometer // int REDpot = A1; int GREENpot = A2; int BLUEpot = A3; //give the potenciometer value to each variable int REDpwm = 0; int GREENpwm = 0; int BLUEpwm = 0; //--------------------------------------------------------------------------------------------------- void setup() { //neopixel pixels.begin(); pinMode(Power,OUTPUT); digitalWrite(Power, HIGH); //output pinmode for each led (red, green, and blue) pinMode(REDled, OUTPUT); pinMode(GREENled, OUTPUT); pinMode(BLUEled, OUTPUT); } //--------------------------------------------------------------------------------------------------- void loop() { //apply the potenciometer values to the variables and adjust their values to go from 0 to 255 REDpwm = analogRead(REDpot)/4; GREENpwm = analogRead(GREENpot)/4; BLUEpwm = analogRead(BLUEpot)/4; //turn on each led with their corresponding pwm analogWrite(REDled, REDpwm); analogWrite(GREENled, GREENpwm); analogWrite(BLUEled, BLUEpwm); //set the color to the neo pixel pixels.setPixelColor(0, pixels.Color(REDpwm, GREENpwm, BLUEpwm)); delay(200); pixels.show(); }