Question: Write a program in C to modify the state of LED1 and LED2 depending upon whether SW1 or SW2 is pressed. At program startup, LED1

Write a program in C to modify the state of LED1 and LED2 depending upon whether SW1 or SW2 is pressed. At program startup, LED1 should be on and LED2 should be off. As long as SW1 is pressed, both LEDs should be turned on and as long as SW2 is pressed, LED1 and LED2 should blink at 4Hz alternately.

Summary: LED1 LED2

No Switch Pressed On Off

SW1 Pressed On On

SW2 Pressed 4Hz 4Hz (alternately)

After Releasing SW1/SW2 Off Off

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!