int potpin = 0; int val,val1,val2,val3; void setup() { pinMode(9,OUTPUT); pinMode(10,OUTPUT); pinMode(11,OUTPUT); } void loop() { val = analogRead(potpin); // reads the value of the potentiometer (value between 0 and 1023) val1 = map(val, 0, 1023, 0, 255); // scale it to use it with the LED (value between 0 and 255) val2 = map(val, 0, 1023, 255, 0); val3 = map(val, 0, 1023, 0, 200); analogWrite(9, val1 ); analogWrite(10, val2 ); analogWrite(11, val3 ); }