
41Chapter2: Two Degrees of Freedom
into the pins using the digitalRead() command.
Once we have set up our push-button variables,
we can use our four sets of conditional statements
to either increase or decrease the values of our
position variables based on our push-button
presses. Lastly, we tell our servos to move to
whatever angle the position variables represent.
STEP 3
Once your code complies correctly, upload your
code. If all goes to plan, you should be able to
independently control the angle of both of the
motors in your arm (Figures
2-13
and
2-14
) by
pressing the two sets of push-buttons. (If you’d
like the motors to move faster or sl ...