const int LEDR = 7;
const int LEDG = 5;
const int LEDB = 3;
const int potR = A0;
const int potG = A1;
const int potB = A2;
void setup() {
// put your setup code here, to run once:
pinMode(LEDR, OUTPUT);
pinMode(LEDG, OUTPUT);
pinMode(LEDB, OUTPUT);
pinMode(potR, INPUT);
pinMode(potG, INPUT);
pinMode(potB, INPUT);
}
int readPot(int pin) {
return map(analogRead(pin), 0, 1023, 0, 255);
}
void loop() {
// put your main code here, to run repeatedly:
analogWrite(LEDR, readPot(potR));
analogWrite(LEDG, readPot(potG));
analogWrite(LEDB, readPot(potB));
}
// map(analogRead(pin), 0, 1023, 0, 255);