Would I like to know why this:
if (digitalRead(4) == LOW) {
doSomething();
}
Randomly triggers as if there’s some unseen demon child hammering a pushbutton on pin 4, however…
int btn;
btn=digitalRead(4);
if (btn == LOW) {
doSomething();
}
… Always works perfectly?
Yes. Yes I would.