-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhomeAutomation.ino
More file actions
52 lines (49 loc) · 872 Bytes
/
homeAutomation.ino
File metadata and controls
52 lines (49 loc) · 872 Bytes
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
void setup()
{
// put your setup code here, to run once:
Serial.begin(9600);
pinMode(8,OUTPUT);
pinMode(9,OUTPUT);
pinMode(10,OUTPUT);
pinMode(11,OUTPUT);
}
void loop()
{
// put your main code here, to run repeatedly:
if(Serial.available()>0)
{
unsigned char cmd = Serial.read();
if(cmd == '1')
{
digitalWrite(8,HIGH);
}
else if(cmd == '2')
{
digitalWrite(8,LOW);
}
else if(cmd == '3')
{
digitalWrite(9,HIGH);
}
else if(cmd == '4')
{
digitalWrite(9,LOW);
}
else if(cmd == '5')
{
digitalWrite(10,HIGH);
}
else if(cmd == '6')
{
digitalWrite(10,LOW);
}
else if(cmd == '7')
{
digitalWrite(11,HIGH);
}
else if(cmd == '8')
{
digitalWrite(11,LOW);
}
}
}