-
Notifications
You must be signed in to change notification settings - Fork 0
/
remote.ino
63 lines (59 loc) · 1.32 KB
/
remote.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
const int rn=9,rp=10,ln=5,lp=6;
void setup() {
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(13,OUTPUT);
pinMode(5,OUTPUT);
pinMode(6,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
}
void loop() {
if (Serial.available()>0)
{
char a = Serial.read();
if (a == 'w')//fw
{
digitalWrite(13,HIGH);
Serial.println("fw");
digitalWrite(rp,HIGH);
digitalWrite(rn,LOW);
digitalWrite(lp,HIGH);
digitalWrite(ln,LOW);
}
else if (a =='s')//bw
{
digitalWrite(13,LOW);
Serial.println("bw");
digitalWrite(rn,HIGH);
digitalWrite(rp,LOW);
digitalWrite(ln,HIGH);
digitalWrite(lp,LOW);
}
else if (a =='a')//lt
{
Serial.println("lt");
digitalWrite(rp,HIGH);
digitalWrite(rn,LOW);
digitalWrite(lp,LOW);
digitalWrite(ln,HIGH);
}
else if (a =='d')//rt
{
Serial.println("rt");
digitalWrite(rp,LOW);
digitalWrite(rn,HIGH);
digitalWrite(lp,HIGH);
digitalWrite(ln,LOW);
}
else if (a =='r')//st
{
Serial.println("stop");
digitalWrite(rp,LOW);
digitalWrite(rn,LOW);
digitalWrite(lp,LOW);
digitalWrite(ln,LOW);
}
}
// put your main code here, to run repeatedly:
}