I myself being a self admitted coding dunderhead, avoid the use of inversion in this case because its easy to overlook.
I'd use direct commands if buttonState3 == HIGH then {digitalWrite (12, LOW) ;} else {digitalWrite(12,HIGH);}
The time delays are for debouncing ? If so, as you add code, it ties up the IO scan time.
To make things more complicated, I'll edge detect, create a "last scan" value. If the value != last scan value ( state changes on an input), it then goes off to do the desired action without waiting a couple seconds. A time delay can be put elsewhere as needed.
I also dont like putting pin #s as a VARIABLE because I make an IO map assignment before I start a small project, altho a couple times would have been convenient. I acquiescence to software folks who want to smack me for even suggesting that party foul :-) In my defense, Im not writing 1000000 lines of code, not creating libraries, and dont code with team members :-)
I myself being a self admitted coding dunderhead, avoid the use of inversion in this case because its easy to overlook.
I'd use direct commands if buttonState3 == HIGH then {digitalWrite (12, LOW) ;} else {digitalWrite(12,HIGH);}
The time delays are for debouncing ? If so, as you add code, it ties up the IO scan time.
To make things more complicated, I'll edge detect, create a "last scan" value. If the value != last scan value ( state changes on an input), it then goes off to do the desired action without waiting a couple seconds. A time delay can be put elsewhere as needed.
I also dont like putting pin #s as a VARIABLE because I make an IO map assignment before I start a small project, altho a couple times would have been convenient. I acquiescence to software folks who want to smack me for even suggesting that party foul :-) In my defense, Im not writing 1000000 lines of code, not creating libraries, and dont code with team members :-)