1int x,y,z,t;
2
3int a=3;
4
5int b=4;
6
7int c=5;
8
9int d=6;
10
11int e=7;
12
13int f=8;
14
15int g=9;
16
17int h=10;
18
19void setup() {
20
21
22
23pinMode(a,INPUT);
24
25pinMode(b,INPUT);
26
27pinMode(c,INPUT);
28
29pinMode(d,INPUT);
30
31pinMode(e, OUTPUT);
32
33pinMode(f,OUTPUT);
34
35pinMode(g,OUTPUT);
36
37pinMode(h,OUTPUT);
38
39Serial.begin (9600);
40
41}
42
43void loop() {
44
45
46
47x=digitalRead(a);
48
49y=digitalRead(b);
50
51z=digitalRead(c);
52
53t=digitalRead(d);
54
55Serial.print(x);
56
57Serial.print(y);
58
59Serial.print(z);
60
61Serial.println(t);
62
63delay(1000);
64
65if (x==1 && y==0 && z==1 && t==1)
66
67{digitalWrite(e,HIGH);
68
69digitalWrite(f,LOW);
70
71digitalWrite(g,HIGH);
72
73digitalWrite(h,LOW);}
74
75if (x==1 && y==1 && z==1 && t==0)
76
77{digitalWrite(e,LOW);
78
79digitalWrite(f,HIGH);
80
81digitalWrite(g,LOW);
82
83digitalWrite(h,HIGH);}
84
85if (x==1 && y==1 && z==0 && t==1)
86
87{digitalWrite(e,LOW);
88
89digitalWrite(f,LOW);
90
91digitalWrite(g,HIGH);
92
93digitalWrite(h,LOW);}
94
95if (x==1 && y==0 && z==0 && t==1)
96
97{digitalWrite(e,HIGH);
98
99digitalWrite(f,LOW);
100
101digitalWrite(g,LOW);
102
103digitalWrite(h,LOW);}
104
105if (x==0 && y==0 && z==1 && t==1)
106
107{digitalWrite(e,LOW);
108
109digitalWrite(f,LOW);
110
111digitalWrite(g,LOW);
112
113digitalWrite(h,LOW);}}