Got blue, red and yellow lights that each can turn ON independently of one another. Using operators, structs, etc. how to obtain the current color, if having: Red & Blue is purple, Blue and Yellow is green and Yellow & Red is Orange. This is not a homework.

1 Year
Discussion Span
Last Post by rubberman

While not homework this doesn't appear to be the place for "give me code." Supply your work so far and where you are stuck.


How you code this depends upon how the lights are integrated into the system. If directly connected to I/O ports of the computer, then you would use io-in and io-out instructions to read or set their states (on or off). If other such as serial ports, the problem is a bit more complicated but not too difficult. What you have posted so far is useless for us to help you.

Votes + Comments
Lights += 1;
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.