-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathFood_serving_robot.ino
81 lines (81 loc) · 1.67 KB
/
Food_serving_robot.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
68
69
70
71
72
73
74
75
76
77
78
79
80
81
//Food Serving Robot
void setup() {
pinMode (2,INPUT);
pinMode (3,INPUT);
pinMode (4,INPUT);
pinMode (5,INPUT);
pinMode (6,OUTPUT);
pinMode (7,OUTPUT);
pinMode (8,OUTPUT);
pinMode (9,OUTPUT);
//pinMode (10,OUTPUT);
//pinMode (11,OUTPUT);
}
void loop() {
//Head Rotation
if (digitalRead(2)==HIGH&&digitalRead(5)==HIGH)
{
digitalWrite(10,HIGH);
digitalWrite(11,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
}
else if (digitalRead(3)==HIGH&&digitalRead(4)==HIGH)
{
digitalWrite(11,HIGH);
digitalWrite(10,LOW);
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
}
//Bot Directions
else if (digitalRead(2)==HIGH)
{
digitalWrite(6,HIGH);
digitalWrite(9,HIGH);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
else if (digitalRead(3)==HIGH)
{
digitalWrite(7,HIGH);
digitalWrite(8,HIGH);
digitalWrite(6,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
else if (digitalRead(4)==HIGH)
{
digitalWrite(6,HIGH);
digitalWrite(8,HIGH);
digitalWrite(7,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
else if (digitalRead(5)==HIGH)
{
digitalWrite(7,HIGH);
digitalWrite(9,HIGH);
digitalWrite(6,LOW);
digitalWrite(8,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
//Stop
else
{
digitalWrite(6,LOW);
digitalWrite(7,LOW);
digitalWrite(8,LOW);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,LOW);
}
}