Dmitron1036:
Hello, Wozsher!
I guess the code is simple.
You need to use PulseIn function:
https://www.arduino.cc/en/Reference/PulseIn
+
if operand.
Like so:#define a 100
#define b 200
#define c 300
#define pin 5
#define GREENLED 10
#define YELLOWLED 11
#define REDLED 12
unsigned long duration;void loop()
{duration = pulseIn(pin, HIGH);
// reset leds
digitalWrite(GREENLED, LOW);
digitalWrite(YELLOWLED , LOW);
digitalWrite(REDLED , LOW);// set leds
if(duration < a){digitalWrite(GREENLED, HIGH);}
else if(duration < b){digitalWrite(YELLOWLED , HIGH);}
else{digitalWrite(REDLED , HIGH);}// pause
delay(200); //ms}
Thank you very much for your help. I'm totally new to Arduino so this is going to be a very steep learning curve.