Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

8 LED Lights should turn on and off starting with the outer two LEDs first followed by the adjacent 2 LEDs inward until it reaches

8 LED Lights should turn on and off starting with the outer two LEDs first followed by the adjacent 2 LEDs inward until it reaches the two most internal LED pairs, each pair being on for 100ms. When the last 2 most inward pair of LED lights turn off, the pattern should invert turning on the next adjacent pair of LEDS until it reaches the the two most outer LEDS in groups of two. (see demo of expected outcome on D2L Lab 1 section). Holding down the switch should slow the speed of the lights turning on and off by a factor of 10.

Instructions 1. Complete led.c, led.h, switch.cpp, and switch.h to fulfill the requirements.

Requirements Overall 1. The program must compile. This can be tested using the checkmark icon. 2. The project must use good coding practices and be well commented.

led.cpp 1. A function implementation that returns void and has no parameters called initLED must be present and is used in the main function to initialize all LED pins as outputs. 2. Pins 4-11 on the development board must be used to control the LEDs. 3. A function implementation called turnOnLED that returns void and has a parameter called led of type unsigned unsigned int must be present. 4. The turnOnLED function must turn *on* the LED corresponding to the pin on the development board and *not affect the state of other LEDs*. 5. A function implementation called turnOffLED that returns void and has a parameter called led of type unsigned unsigned int must be present. 6. The turnOffLED function must turn *off* the LED corresponding to the pin on the development board and *not affect the state of other LEDs*. 7. A function implementation called runLED that returns void and has a parameter call led of type unsigned int. 8. The runLED function implements both turnOnLED and turnOffLED. The function runLED turns the current LED pair on and the previous LED pair off in ascending order across the board so that only two LEDs are lit at any time.

switch.cpp 1. A function implementation that returns void and has no parameters called initSwitch must be present and is used in the main function to initialize *pin 22* on the development board as an input.

main 1. A call to initLED() and initSwitch() must be present in the main function. 2. An infinite while loop must be present. 3. A call to runLED must be present in the main loop. 4. While the switch is not pressed, the LEDs must change every 100 ms and while the switch is pressed, the LEDs must change with a rate *1/10 th* as fast. 5. In this lab you will use the built-in library function: void_delay_ms(unsigned int) to perform a delay of (unsigned int) milliseconds. Use the include statement #include

Please I need the code that is gonna run on Platform I/O (Visual Studio). I need the main.cpp code and led.cpp. Please read the question also

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Processing Fundamentals Design And Implementation

Authors: David M. Kroenke

5th Edition

B000CSIH5A, 978-0023668814

More Books

Students also viewed these Databases questions

Question

Question What is a Roth 403 (b) plan?

Answered: 1 week ago

Question

Question Can a Keogh plan fund be reached by the owners creditors?

Answered: 1 week ago