#define LED1 16
#define LED2 17
#define LED3 18
#define POTEN 34
int poten_value;
int MapPoten;
void setup() {
Serial.begin(9600);
pinMode(LED1, OUTPUT);
pinMode(LED2, OUTPUT);
pinMode(LED3, OUTPUT);
}
void loop() {
poten_value = analogRead(POTEN);
MapPoten = map(poten_value,0,4095,0,100);
Serial.println(MapPoten);
if (MapPoten==0){
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
}
else if (MapPoten>=30 && MapPoten<=60){
digitalWrite(LED1, HIGH);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
}
else if (MapPoten>=60 && MapPoten<=90){
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, LOW);
}
else if (MapPoten>=90 && MapPoten<=99){
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
}
else if (MapPoten==100){
digitalWrite(LED1, HIGH);
digitalWrite(LED2, HIGH);
digitalWrite(LED3, HIGH);
delay(500);
digitalWrite(LED1, LOW);
digitalWrite(LED2, LOW);
digitalWrite(LED3, LOW);
delay(500);
}
delay(1000);
}