You can download the package on our website and find the program in the folder:
Obviously, the paw is used for picking up objects. It runs the two servos as the motion joint. One is to control the opening and closing of the paw and the other is to control the rotation. Each servo is controlled by one potentiometer. Now let’s take a look at the detailed code.
As the paw uses the two servos as the motion joint, first include a library file of servo drive and define two objects.
Since the servo is controlled by potentiometer, next, read the AD value of the potentiometer and convert it into the value of the servo’s rotation angle.
Another important program for the performance of the paw is, how to write the servo’s rotation angle converted from previous part to the servo thus making it rotate. The functions needed can be just called in the software; what we need to do is deal with the angle value. In other words, instead of writing the targeted angle to the servo directly, it would be better to write the value bit by bit to keep the movement of the paw in a uniform manner.
Take the code for one servo for example:
With the explanations above, we have a general understanding of the program of the paw. For detailed program, please download the package on our website.
Notes:
- Before connecting the servo wires, please turn the power OFF. Turn on the power only after the wiring is all done.
- When the servos are powered on, remember NOT to try to rotate the servos. If you really need to rotate it, switch the power off.
- DO NOT keep the servos idling in case of damages. Therefore, if you are not running the Rollpaw, you should keep it power off.