First interaction
Coded the button interaction. Electronic buttons need a hack known as debounce because they bounce back and forth between 0 and 1 very quickly until they settle. The hack consists of reading the button twice with a short delay (say 10ms) to see if the state is the same.
So here’s what the code does now: init the screen, button and speaker. When the button is pressed the speaker beeps a middle-A note and the screen inverts (black to white or white to black).
Now to figure out the game loop!