Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

this is in c programming lanuage This is the problem I was given Initially, your program should ensure that all of the 6 LEDs are

this is in c programming lanuage

This is the problem I was given Initially, your program should ensure that all of the 6 LEDs are off(3red 3 green). Each time Switch 1 is pressed, one of the red LEDs that is off should be turned on. Each time Switch 2 is pressed, one of the green LEDs that is off should be turned on. Each time Switch 3 is pressed, one of the green LEDs that is on should be turned off and one of the red LEDs that is on should also be turned off.

I have most of this working I am using a counter to count how many times the switch one and two have been pressed and turn on lights at the correct time I am wondering the pest was to implement switch 3. Do I need to store the state of each light and use a bunch of if statments? like if redled1 and redled2 is on and switch 3 is pressed turn off redled2. then if redled1 is on and switch 3 is pressed turn off redled1. Then do something similar for the green leds but turning them in instead.

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

Step: 3

blur-text-image

Ace Your Homework with AI

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

Get Started

Students also viewed these Databases questions