I have been trying to build a RGBW led controller that uses pots right now but i would like to move over to photoresistors for the project i have. I want to take the colors of light outside and reproduce them inside with white as well.
I got it to work with RGB, but when i went to add the White channel i broke it somehow. I dont know much about writing the code but i can read it. I would like to add a pot to control all channels as a dimmer as well.
Can someone help me with the code please. Here is the code i have and a layout of what i have so far
const int analogPOTinRED = A0;
const int analogPOTinGREEN = A1;
const int analogPOTinBLUE = A2;
const int analogPOTinWHITE = A3;
const int analogPOTinALL = A4;
const int DigitalLEDoutRED = 11;
const int DigitalLEDoutGREEN = 10;
const int DigitalLEDoutBLUE = 9;
const int DigitalLEDoutWHITE = 6;
int PotValueRED = A0;
int PotValueGREEN = A1;
int PotValueBLUE = A2;
int PotValueWHITE = A3;
int PotValueALL = A4;
int LedValueRED = 11;
int LedValueGREEN = 10;
int LedValueBLUE = 9;
int LedValueWHITE = 6;
void setup() {
Serial.begin(9600);
}
void loop() {
PotValueRED = analogRead(analogPOTinRED);
PotValueGREEN = analogRead(analogPOTinGREEN);
PotValueBLUE = analogRead(analogPOTinBLUE);
PotValueWHITE = analogRead(analogPOTinWHITE);
PotValueALL = analogRead(analogPOTinALL);
PotValueRED = map(PotValueRED, 0, 1023, 0, 255);
PotValueGREEN = map(PotValueGREEN, 0, 1023, 0, 255);
PotValueBLUE = map(PotValueBLUE, 0, 1023, 0, 255);
PotValueWHITE = map(PotValueWHITE, 0, 1023, 0, 255);
analogWrite(analogPOTinRED, DigitalLEDoutRED);
analogWrite(analogPOTinGREEN, DigitalLEDoutGREEN);
analogWrite(analogPOTinBLUE, DigitalLEDoutBLUE);
analogWrite(analogPOTinWHITE, DigitalLEDoutWHITE);
Serial.print("\t POT RED = ");
Serial.print(analogPOTinRED);
Serial.print("\t POT GREEN = ");
Serial.print(analogPOTinGREEN);
Serial.print("\t POT BLUE = ");
Serial.print(analogPOTinBLUE);
Serial.print("\t POT WHITE = ");
Serial.print(analogPOTinWHITE);
Serial.print("\t POT ALL = ");
Serial.print(analogPOTinALL);
Serial.print("\t LED RED = ");
Serial.println(DigitalLEDoutRED);
Serial.print("\t LED GREEN = ");
Serial.println(DigitalLEDoutGREEN);
Serial.print("\t LED BLUE = ");
Serial.println(DigitalLEDoutBLUE);
Serial.print("\t LED WHITE = ");
Serial.println(DigitalLEDoutWHITE);
delay(2);
}

