Question: Create code to turn on a flashing led ( say 10Hz) with a push button. Pushing the button again will turn it off. Do it
Create code to turn on a flashing led ( say 10Hz) with a push button. Pushing the button again will turn it off. Do it in this way:
- Use the port interrupt A to control the state of a global variable, or semaphore. If you interrupt portA, the flag toggles value between 1 and 0.
- In the main loop the flag bit is queried. The flashing led turns on if semaphore=1 and off if 0. You can use simple software delays to make the flashing since the interrupt will pre-empt any delays.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
