Light Switch
A button is connected to PA0. When pressed (pin goes high), turn on the LED at PA5. When released (pin goes low), turn off the LED.
Your firmware should:
- Configure PA0 as input
- Configure PA5 as output
- Poll PA0 and mirror its state to PA5
Use BSRR (not ODR read-modify-write) to set/clear PA5: a single BSRR write sets or clears the pin atomically, with no read-modify-write window for an interrupt to corrupt. We'll press the button twice during the test.