int analog_pin = 7;
int led_Red = 7;
int led_Yellow = 8;
int led_Green = 9;
float val;
float volt;
void setup() {
pinMode(led_Red, OUTPUT);
pinMode(led_Yellow, OUTPUT);
pinMode(led_Green, OUTPUT);
}
void loop() {
val = analogRead(analog_pin);
volt = val*5/1024;
if(volt<0.05){
delay(250);
digitalWrite(led_Red, LOW);
digitalWrite(led_Yellow, LOW);
digitalWrite(led_Green, LOW);
delay(250);
}else{
analogWrite(led_Red, volt*50);
if (val>345){
analogWrite(led_Yellow, volt*50);
}
if (val>682){
analogWrite(led_Green, volt*50);
}
}
}