int greenled = D0; int whiteled = D6; int orangeled = D7; int brightness = 0; // how bright the LEDs are int fadeAmount = 5; // how many points to fade the LEDs by int potentiometerPin = A2; // the analog pin the potentiometer is attached to int potValue = 0; void setup() { pinMode(greenled, OUTPUT); pinMode(whiteled, OUTPUT); pinMode(orangeled, OUTPUT); } void loop() { // read the value from the potentiometer: potValue = analogRead(potentiometerPin); // map the potentiometer value to a brightness value between 0 and 255: brightness = map(potValue, 0, 1023, 0, 255); // set the brightness of each LED: analogWrite(greenled, brightness); analogWrite(whiteled, brightness); analogWrite(orangeled, brightness); // wait for a short time to see the effect: delay(30); }