Upside Down
STM32 Button Reads Inverted Debug
Symptom
The simplest test for a button on a new board is a lamp that lights only while the button is held. A colleague wrote that program for this board, and it is broken.
What it should do: button on PA0 held -> LED on PA5 on button up -> LED off
What it does instead: the LED is on while nobody touches the button, and goes off while the button is held.
Find the mistake in main.c and fix it. While your program runs, the button is pressed and released, and a logic analyzer records PA5.
Circuit
Pass condition
From power-up on, for as long as the board runs: button held -> PA5 high; button up -> PA5 low. PA5 changes only when the button does. Timing is not graded.