Yet More Buttons! -- Single, Multiple, Matrix Add-a-Sketches

wvmarle:
I just had to think immediately on the many "my buttons don't work!" threads where the code is filled with long delay() statements and the like...

And buttons work with code that has long delays .... with interrupt and still the sketch has to wait but I dunno how else.

The lesson about using millis for timing is the start for learning automation. It unlocks Do Many Things At Once. The corollary is Do Them In Quick Steps that leads to state machines and more responsive code.

You can code for events in a certain order and time. That invites debugging with delays just to impose order.

You can code for events to happen whenever they do and the sketch to react appropriately even if to report an error.

I came across a problem with the main code checking button status more often than the button is read but only a problem with status 127 and 128. I fixed it but I'm not incredibly happy with the fix. I should change the status value instead, 128 to 0 and 127 to 255 as that would be cleaner and save a byte.