✅ The verified answer to this question is available below. Our community-reviewed solutions help you understand the material better.
Single_Button_Light_Move_Control:
Your second task is to modify your code for the first task to control four different move rates by a single button (PortB 0). Each “PortB 0” press should switch the light move rate to the next rate (in the order: turn-off, slow, faster, much faster, and then turn-off).
Procedure:
Important Hint: When you press a button, the mechanical contacts can undergo a transient state of short-duration connections and disconnections until they reach their final state. This is called “BOUNCING.” It is possible to eliminate bouncing with “DEBOUNCING” hardware; however, in this experiment, you are expected to implement “DEBOUNCING” in software.