void setup() { Serial.begin(9600); pinMode(2, OUTPUT); pinMode(3, OUTPUT); pinMode(4, OUTPUT); pinMode(5, OUTPUT); } void loop() { int x = analogRead(A0); Serial.print("x:"); Serial.println(x); if(x <= 140){ digitalWrite(2, LOW); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); } else if(x > 140 && x <= 280){ digitalWrite(2, HIGH); digitalWrite(3, LOW); digitalWrite(4, LOW); digitalWrite(5, LOW); } else if(x > 280 && x <= 420){ digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, LOW); digitalWrite(5, LOW); } else if(x > 420 && x <= 580 ){ digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); digitalWrite(5, LOW); } else { digitalWrite(2, HIGH); digitalWrite(3, HIGH); digitalWrite(4, HIGH); digitalWrite(5, HIGH); } delay(100); }