
97Chapter 5: The Joy of Joysticks
servoOne.write(posOne);
Serial.print(posOne);
Serial.print(" Position Two: ");
servoTwo.write(posTwo);
Serial.println(posTwo);
}
Once you have compiled and uploaded the code, you
should see your servos respond when the joystick is
moved in either direction. As you move it, you may
notice that the motors now stay where you left them.
The joystick can be moved to control the position of
the two joints in the system, and the joints remain
in place when there is no input on the joystick. This
represents a significant improvement over our
previous example. But what if we could use this
joystick to point the robot exactl ...