forked from VarshaShiburaj/Virtual-Telepresence-Robot
-
Notifications
You must be signed in to change notification settings - Fork 0
/
arduino code.ino
69 lines (64 loc) · 1.25 KB
/
arduino code.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
char c='s';
void setup()
{
Serial.begin(9600);
Serial2.begin(9600);
Serial2.println("bLuEtOoTh InItIaTeD....");
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(10,HIGH);
digitalWrite(11,HIGH);
Serial1.println("Stop");
}
void loop()
{
if(Serial2.available())
{
c=Serial2.read();
}
delay(80);
if(c=='s')
{
digitalWrite(8,HIGH);
digitalWrite(9,HIGH);
digitalWrite(10,HIGH);
digitalWrite(11,HIGH);
Serial2.println("Stop");
}
else if(c=='a')
{
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
Serial2.println("Forward");
}
else if(c=='b')
{
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
digitalWrite(10,HIGH);
digitalWrite(11,LOW);
Serial2.println("Reverse");
}
else if(c=='c')
{
digitalWrite(8,LOW);
digitalWrite(9,HIGH);
digitalWrite(10,HIGH);
digitalWrite(11,LOW);
Serial2.println("Right");
}
else if(c=='d')
{
digitalWrite(8,HIGH);
digitalWrite(9,LOW);
digitalWrite(10,LOW);
digitalWrite(11,HIGH);
Serial2.println("Left");
}
}