const int R_LED_PIN = 11;
const int G_LED_PIN = 10;
const int B_LED_PIN = 9;
int readPot(int pin) {
return map(analogRead(pin), 0, 1023, 0, 255);
}
void setup() {
Serial.begin(115200);
pinMode(R_LED_PIN, OUTPUT);
pinMode(G_LED_PIN, OUTPUT);
pinMode(B_LED_PIN, OUTPUT);
}
void loop() {
analogWrite(R_LED_PIN, readPot(A2));
analogWrite(G_LED_PIN, readPot(A1));
analogWrite(B_LED_PIN, readPot(A0));
}