
25Chapter 1: The Foundation of Robotic Arms
If we write out the logic of our conditional statement
and translate it from speaking robot into English,
the logic of our conditional statements looks
something like this: “If push-button 1 is pressed,
make the number variable pos larger by one every
50 milliseconds; if push-button 2 is pressed, make
the variable pos smaller by one, also every 50
milliseconds.” With that sorted out, the last thing
we need to do is tell the servo to go to whatever the
value of pos happens to be as we press our push-
buttons. With that, our code is complete.
Now, push-buttons are great for sending simple
signals to our ...