Rookie Mistake
so im trying to code on arduino droid using a push button to trigger led, why isnt this code working for turning on the led but the button is working as usual checking the monitor

4 Replies
the
loop should go like this:
(digitalWrite and if else staments should be in the same line)
@Zeri have a few question, is using "if" mandatory in this scenario, and is 1 and 0 indicate the output led state? thanks for answering ill try it llater
im still new on coding and arduino so mb if i look oblivious because i am 💀
ill try to understand
yes, 'if' you want the button to decide LED state, the using 'if' is mandatory
and also, 1 mean 'HIGH' and 0 means 'LOW'
basically, 'if' button pressed, then turn on led (1)
'else' turn it off
if and else are the absolute bare basics, you should learn them, else you might not be able to write higher programsohh okay, thankyou for your guidance, i thought that it isn't mandatory
okay thanks