const int pinR = 0;
const int pinG = 2;
const int pinB = 4;
const int potR = 32;
const int potG = 33;
const int potB = 34;
void setup() {
Serial.begin(115200);
pinMode(pinR, OUTPUT);
pinMode(pinG, OUTPUT);
pinMode(pinB, OUTPUT);
pinMode(potR, INPUT);
pinMode(potG, INPUT);
pinMode(potB, INPUT);
}
int readPot(int pin) {
return map(analogRead(pin), 0, 1023, 0, 255);
}
void loop() {
analogWrite(pinR, readPot(potR));
analogWrite(pinG, readPot(potG));
analogWrite(pinB, readPot(potB));
}