const int pinR = 4;
const int pinG = 2;
const int pinB = 15;
const int potR = 27;
const int potG = 26;
const int potB = 25;
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, 4095, 0, 255);
}
void loop() {
analogWrite(pinR, readPot(potR));
analogWrite(pinG, readPot(potG));
analogWrite(pinB, readPot(potB));
delay(500);
}