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

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!