Pages: 1 2 [3]   Go Down
Author Topic: if pin 1 is high in 3seconds led will turn on else ignore .(if statement .help.)  (Read 1701 times)
0 Members and 1 Guest are viewing this topic.
Queens, New York
Offline Offline
Faraday Member
**
Karma: 98
Posts: 3576
"Of all the things I've ever lost, I miss my mind the most" -Ozzy Osbourne
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Created Libraries:
NPV2 (NewPasswordV2),  TFT_Extension, OneWireKeypad, SerialServo.
Will provide libraries if asked in PM or forum.

isabela, philippines.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
if you dont go, you will never know.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 )
Logged

jaylisto

isabela, philippines.
Offline Offline
Jr. Member
**
Karma: 1
Posts: 62
if you dont go, you will never know.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

problem is solved.


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

Logged

jaylisto

Pages: 1 2 [3]   Go Up
Jump to: