const int pot = A5;
const int ledcount = 10;
int ledpin[]={
3,4,5,6,7,8,9,10,11,12,
};
void setup() {
Serial.begin(9600);
for (int thisled = 0; thisled < ledcount; thisled++) {
pinMode(ledpin[thisled], OUTPUT);
}
}
void loop() {
int valp = analogRead(pot);
int VALP = map(valp, 0, 1023, 0, ledcount);
Serial.println(VALP);
for (int thisled = 0; thisled < ledcount; thisled++) {
if (thisled < VALP){
digitalWrite(ledpin[thisled], HIGH);
}
else {
digitalWrite(ledpin[thisled], LOW);
}
//Serial.print(thisled);
}
}