Activity 2.7.1. toggleLED Code Review.
Set up your Nucleo with your
toggleLED.c (debounce capacitor across the switch) and share it with your group.
(a)
Read each partner’s code. Can you follow its logic and explain it line by line? There are at least two valid structures using a
buttonAlreadyPressed flag: one checks the flag in the outer if, the other checks buttonPushed first. Are both correct? Is one clearer?
(b)
Identify the parts of your code that correspond to FSM concepts: where is the state stored? What are the events? What action happens on which transition? We will formalize this next.
