#define ledR 11
#define ledG 10
#define ledB 9
#define potR A0
#define potG A1
#define potB A2
void setup() {
Serial.begin(115200);
pinMode(ledR, OUTPUT);
pinMode(ledG, OUTPUT);
pinMode(ledB, OUTPUT);
pinMode(potR, INPUT);
pinMode(potG, INPUT);
pinMode(potB, INPUT);
}
void loop() {
int bacaR = map(analogRead(potR),0,1023,0,255);
int bacaG = map(analogRead(potG),0,1023,0,255);
int bacaB = map(analogRead(potB),0,1023,0,255);
Serial.print(bacaR);
Serial.print(" ");
Serial.print(bacaG);
Serial.print(" ");
Serial.println(bacaB);
ledRGB(bacaR,bacaG,bacaB);
}
void ledRGB(int R,int G,int B){
analogWrite(ledR,R);
analogWrite(ledG,G);
analogWrite(ledB,B);
}