
160 Make: Robotic Arms
motorSelector = 1;
}
delay(1);
}
Now, there is a lot to unpack here. That said, despite the
significant increase in length, this most recent version of
our robotic-arm code is nothing more than our last two
examples put together. This newest version of our code will
allow us to accurately control the angles of each one of our
servos through the use of a rotary encoder, allowing us to
select which motor is active at a given time by pressing the
integrated push-button. Let’s break this code down and take
a closer look at how it all works.
First, we have our variables above our void setup. Though we
now have quite a few variabl ...