
161Chapter 8: Rotary Encoder Control
the other position variables for our other motors, is altered. One
of the strangest portions of the code is when the value of the
motor-selection variable has a value of 2. In this case, we need to
control both our link 2 motors, which work together. This means
we need one value to increase and one value to decrease in order
to have a result in which the link itself moves in one direction.
The rest of our void loop is dedicated to instructing our servo to
react to the changing position variables, printing the value of our
position variables, and managing the motor-selection variable,
much like as with our pr ...