const int Pin[]={0,1,2,3,4,5,6,7};
const int pot = A0;
void setup() {
for (int i = 0; i<8;i++){
pinMode(Pin[i],OUTPUT);
}
pinMode(pot,INPUT);
}
void loop() {
int pot= analogRead(A0);
pot = map(pot,0,1023,0,7);
for (int i = 0; i<8;i++){
digitalWrite(Pin[i],i==pot ? HIGH:LOW);
}
}