I created gripper that was made out of laser cut wood. The gripper is controlled by a servo motor that is attached to one of the gears on the gripper. The servo rotates the gears which move the arms of the gripper, allowing them to open and close. There are 2 buttons that rotate the servo clockwise or counterclockwise when pressed.
Link to video of gripper moving: https://drive.google.com/file/d/0B35Qci0Dl57aUXh1eFFZR2piUW8/view?usp=sharing
The code is below:
#include
int angle = 0;
Servo servo;
void setup() {
pinMode(2, INPUT);
pinMode(3, INPUT);
servo.attach(9);
}
void loop() {
if (digitalRead(3) == HIGH && angle < 180) {
angle++;
servo.write(angle);
delay(15);
}
if (digitalRead(2) == HIGH && angle > 0) {
angle--;
servo.write(angle);
delay(15);
}
}
Leave a Reply
You must be logged in to post a comment.