
150 Make: Robotic Arms
if (btnState == LOW ) {
Serial.println("Button Pressed!");
delay(100);
}
delay(1);
}
Now, this sketch is quite a bit longer than some of other code
examples, and there is a lot going on here. Unfortunately, as your
methods of input become more advanced, the software needed to
read its data can become more complicated. With that, let’s break
down what we have written and discuss how we might be able to
use this data to control the motors in our robotic-arm design.
One of the first things we need to do in our code is create the
variables we require to read the data from our rotary encoder.
First, we establish a CLK (clock) ...