Chapter 24: Problem 1
In closing, here's an interesting question. If the round-robin switch had numerous states, say a dozen or so, a single increment button might prove a little frustrating to the user. For example, if they accidentally go past the desired setting then they're forced to go all the way around again to effectively "back up". To alleviate this we could add a decrement pushbutton alongside our existing increment pushbutton. How would the code example presented above need to be altered to respond to a two button configuration? If at first this appears to be too daunting of a challenge, then break it into two parts. Initially, consider how the preceding code would need to be altered in order to change the operation of the fan speed increment button into a fan speed decrement button. That is, instead of button pushes producing the sequence offlow-med-high-off etc., implement the button to produce off-high- med-low-off etc. Once this is completed, determine how to combine this new implementation with the existing example code.
Short Answer
Step by step solution
Key Concepts
These are the key concepts you need to understand to accurately answer the question.