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.

Recommended Answers

All 4 Replies

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.

A good deal.

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.

commented: Lights += 1; +11
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.