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
const int b[]=(1,2,3,4);
int i;

const int c[]=(5,6,7,8);
int k;

const int d[]=(1,2,3,4,5,6,7,8,10);
int o;

const int analoglight=A0;
int V=0;
const int preV=700;
const int a=10

void setup() {
// put your setup code here, to run once:
pinMode(a,OUTPUT);
pinMode(b[i],OUTPUT);
pinMode(c[k],OUTPUT);
Serial.begin(9600);
Serial.println("Welcome");
for(i=0;i<4;i++);
for(k=0;k<4;k++);
}

void loop() {
// put your main code here, to run repeatedly:
if(Serial.available())
{
val= Serial.read();
if(val=='1')
{
Serial.println("LED ON");
{
digitalWrite(d[o],HIGH);
}

}
if(val=='2')
{for(i=0;i<4;i++);
digitalWrite(a[i],HIGH);
delay(1000);
digitalWrite(a[i],LOW);
}
if(val=='3')
{for(k=3;k>0;k--)
digitalWrite(c[k],HIGH);
delay(1000);
digitalWrite(c[k],LOW);
}
if(val=='4')
V=analogRead(analoglight);
if(V<preV)
digitalWrite(a,HIGH);
if(V>preV)
digitalWrite(a,LOW);

else if(val=='0'){
digitalWrite(a,LOW);
digitalWrite(b[i],LOW);
digitalWrite(c[k],LOW);
digitalWrite(d[o],LOW);
Serial.println("LED OFF");
}
}
}