-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathLV1
68 lines (64 loc) · 1.34 KB
/
LV1
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
int main(void)
{
int swt1 = 0;
int swt2 = 0;
int swt3 = 0;
int state = 0;
while (1)
{
if (P1 && swt1 != 1)
{
swt1 = ~swt1;
}
if (P2 && swt2 != 1)
{
swt2 = ~swt2;
}
if (P3 && swt3 != 1)
{
swt3 = ~swt3;
}
Delay;
switch (swt1)
{
case 0:
break;
case 255:
second++;
swt1 = ~swt1;
break;
}
switch (swt2)
{
case 0:
break;
case 255:
{
switch (swt3)
{
case 0:
minute++;
swt2 = ~swt2;
break;
case 255:
minute = 0;
second = 0;
swt2 = ~swt2;
break;
}
}
break;
}
switch (swt3)
{
case 0:
state = 1; //Paused
break;
case 255:
state = 2; //Counting
minute--;
second--;
}
printf();
}
}