Question: Write a program in C (Not Python) to be run on a Raspberry Pi that wil interface to 3 LEDs and 2 switches. The LEDs

Write a program in C (Not Python) to be run on a Raspberry Pi that wil interface to 3 LEDs and 2 switches. The LEDs are on GPIO 23, 24, and 25. The switches are on GPIO 17, and 18. The program will make the LEDs to blink in a "Knight Rider" pattern, meaning that when LED A turns off, LED B turns on, then when LED B turns off, LED C turns on. Once LED C turns off, then LED B needs to turn back on. So the LED will blink back and forth.

The program must meet this criteria:

o When switch A is pressed, all LEDs will light. Each LED must exhibit normal brightness: not too bright and not too dim. This means you should use your knowledge from Lab 1 when deciding how to interface your hardware.

o When switch B is pressed and switch A is not pressed, the LEDs will cycle in a knight rider pattern where only one LED is lit at a time and the LED appears to bounce from side to side. The speed of bounce must be slow enough to see.

o When both switches are pressed, all LEDs will light. Same as first item. Basically switch A has priority.

o When no switch is pressed, all LEDs will be 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!