Go Down

Topic: if pin 1 is high in 3seconds led will turn on else ignore .(if statement .help.) (Read 2125 times) previous topic - next topic

HazardsMind

I was referring to the without delay method. That code is looking for a "constant" HIGH for 3 seconds. As I said before, you need to measure your pin, and set the IF statement accordingly. Analog high is 255, so if the pin is NOT 255 for 3 seconds, it won't trigger. So you need to set a value range so that it does trigger after 3 seconds.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

jaylisto


I was referring to the without delay method. That code is looking for a "constant" HIGH for 3 seconds. As I said before, you need to measure your pin, and set the IF statement accordingly. Analog high is 255, so if the pin is NOT 255 for 3 seconds, it won't trigger. So you need to set a value range so that it does trigger after 3 seconds.


you mean this one?

if (buttonState == true && lastReading == false)

to

if (buttonState > 1 && lastReading < 1 )
jaylisto

jaylisto

problem is solved.


thanks to the help of the genius.... i whats your name genius man? btw, thanks "HazardsMind"

jaylisto

Go Up