forked from SakshamEmb/Robotic-Arm
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Final_Gripper_servo.ino
67 lines (45 loc) · 1.5 KB
/
Final_Gripper_servo.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
#include <Servo.h>
Servo myservo; // create servo object to control a servo
// twelve servo objects can be created on most boards
int pos = 0; // variable to store the servo position
int move ; // for incoming serial data
void setup() {
Serial.begin(9600);
myservo.attach(9); // attaches the servo on pin 9 to the servo object
}
void loop() {
Serial.println("move??");
// send data only when you receive data:
while(!Serial.available());
// read the incoming byte:
move = Serial.parseInt();
// say what you got:
if(move==0){
}
if(move==1){
myservo.write(75);
for(int i=90;i>=0;i=i-4)
{/*
myservo.write(i);
delay(10);
*/
delay(1300);
myservo.write(90);
break ;
}
}
if(move==2)myservo.write(90);
if(move==3)
{/*
for(int j=100;j<180;j=j+4)
myservo.write(j);
delay(20);
*/
myservo.write(110);
delay(800);
myservo.write(90);
while(1){
break;
}
}
}