int leds[] = {8, 9, 10, 11, 12}; //create an array with the led pins int potPin = A0; //location of potentiometer int sensorValue = 0; //starting val of potentiometer void setup() { for(int i = 0; i < 5; i++) //loops through the led array { pinMode(leds[i], OUTPUT); //sets all leds as output } } void loop() { sensorValue = analogRead(potPin); //reads value of the potentiometer for (int i = 0; i < 5; i++) //loops through the led array { if((i * 204) < sensorValue) // number 204 is just 1023/number of leds { digitalWrite(leds[i], HIGH); //turns on each led depending on value } else { digitalWrite(leds[i], LOW); //otherwise turn them off } } }