tkt8 / LightItUp

0 stars 0 forks source link

Code Check #26

Closed tkt8 closed 5 years ago

tkt8 commented 5 years ago

Can you please help me with the code? On line 37 the flow is passing through the if even when the button is not pressed and the operating mode keeps toggling continuously. I cannot figure out why.

mlp6 commented 5 years ago

https://github.com/tkt8/LightItUp/blob/e71b848ee7b74ecb982f92ca1bb226b044b7be50/Software/led_blink/led_blink.ino#L37

mlp6 commented 5 years ago

Have you output the state of buttonIsPushed when it is being evaluated at this line? Is it actually true?

tkt8 commented 5 years ago

It keeps toggling. Have tried changing the button also to no avail

mlp6 commented 5 years ago

I would avoid using the delay() command if possible. That will stall the running loop(), which can make the operation of the device "clunky". Do you need all of those 1 sec delays?

tkt8 commented 5 years ago

That was just to visualize the serial monitor status. Will remove them just in case and try.

tkt8 commented 5 years ago

Found out the reason it was toggling. Code is working now. Thanks