Line 26... |
Line 26... |
26 |
|
26 |
|
27 |
|
27 |
|
28 |
|
28 |
|
29 |
while(TRUE){ |
29 |
while(TRUE){ |
30 |
t=read_adc(); // Prvni precteni cidla |
30 |
t=read_adc(); // Prvni precteni cidla |
31 |
printf("%d\n\r",t); |
31 |
//printf("%d\n\r",t); |
32 |
|
32 |
|
33 |
if(t>00&&t<75){ |
33 |
if(t>00&&t<40){ |
34 |
output_low(LED2); |
34 |
output_low(LED2); |
35 |
output_low(LED3); |
35 |
output_low(LED3); |
36 |
output_high(LED1); |
36 |
output_high(LED1); |
37 |
//rozsvit modrou |
37 |
//rozsvit modrou |
38 |
} |
38 |
} |
39 |
else if(t>74&&t<85){ |
39 |
else if(t>39&&t<60){ |
40 |
output_low(LED3); |
40 |
output_low(LED3); |
41 |
output_high (LED1); // Zhasneme LED |
41 |
output_high (LED1); // Zhasneme LED |
42 |
delay_us(100); |
42 |
delay_us(100); |
43 |
output_low (LED1); // Rozsvitime LED |
43 |
output_low (LED1); // Rozsvitime LED |
44 |
delay_us(100); |
44 |
delay_us(100); |
Line 46... |
Line 46... |
46 |
delay_us(100); |
46 |
delay_us(100); |
47 |
output_high (LED2); // Zhasneme LED |
47 |
output_high (LED2); // Zhasneme LED |
48 |
delay_us(100); |
48 |
delay_us(100); |
49 |
//rozsvit modrou+zelenou |
49 |
//rozsvit modrou+zelenou |
50 |
} |
50 |
} |
51 |
else if(t>84&&t<100){ |
51 |
else if(t>59&&t<80){ |
52 |
output_low(LED3); |
52 |
output_low(LED3); |
53 |
output_low(LED1); |
53 |
output_low(LED1); |
54 |
output_high(LED2); |
54 |
output_high(LED2); |
55 |
//rozvit zelenou |
55 |
//rozvit zelenou |
56 |
} |
56 |
} |
57 |
else if(t>99&&t<115){ |
57 |
else if(t>79&&t<100){ |
58 |
output_low(LED1); |
58 |
output_low(LED1); |
59 |
output_high (LED3); // Zhasneme LED |
59 |
output_high (LED3); // Zhasneme LED |
60 |
delay_us(100); |
60 |
delay_us(100); |
61 |
output_low (LED3); // Rozsvitime LED |
61 |
output_low (LED3); // Rozsvitime LED |
62 |
delay_us(100); |
62 |
delay_us(100); |
Line 64... |
Line 64... |
64 |
delay_us(100); |
64 |
delay_us(100); |
65 |
output_high (LED2); // Zhasneme LED |
65 |
output_high (LED2); // Zhasneme LED |
66 |
delay_us(100); |
66 |
delay_us(100); |
67 |
//rozsvit zelenou+cervenou |
67 |
//rozsvit zelenou+cervenou |
68 |
} |
68 |
} |
69 |
else if(t>114){ |
69 |
else if(t>99){ |
70 |
output_low(LED1); |
70 |
output_low(LED1); |
71 |
output_low(LED2); |
71 |
output_low(LED2); |
72 |
output_high(LED3); |
72 |
output_high(LED3); |
73 |
//rozsvit cervenou |
73 |
//rozsvit cervenou |
74 |
} |
74 |
} |