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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
| /*******************************************************/
/** Hobbykas */
/*******************************************************/
long nummer; // initialiseer variabelen
int programma;
string tekst;
const tabel1[]= 0, 1, 2, 10, 12, 16, 4, 8, 10, 12, 16, 0, 0, 0, 0, 0;
const tabel2[]= 0, 1, 2, 10, 12, 16, 0, 0, 0, 0, 0, 4, 8, 10, 12, 16;
int i, teller;
int tijd_1[20];
int tijd_2[20];
int tijd;
int hour;
int minute;
int second;
int sectie;
//-------------------------Initialiseer tijden
function f_initialiseer() //stel tijd in
//-------------------------
{
for teller = 0 ... 16
{
tijd_1[teller] = tabel1[teller]; // laad standaard tijden
tijd_2[teller] = tabel2[teller];
}
}
//-----------------------------------
thread noodstop // Programm Stop F3
//-----------------------------------
{
if station_io.getkey()==12 // F3
{
station_io.init();
station_lcd.clear();
station_lcd.print("programma gestopt");
quit 63;
}
}
//------------------------------------------
function f_input_klok() //stel klok in
//------------------------------------------
{
station_lcd.clear();
station_lcd.print("Tijd instellen");
station_lcd.line2();
station_lcd.cursorpos(2,4);
station_lcd.print("uur:");
station_lcd.cursorpos(2,0);
station_lcd.cursoron();
hour=station_io.getcode();
sleep 1000;
station_lcd.clear2();
station_lcd.cursorpos(2,4);
station_lcd.print("minuten:");
station_lcd.cursorpos(2,0);
minute=station_io.getcode();
sleep 1000;
system.settime(hour,minute,0);
str.putlong (tekst,hour);
station_lcd.clear();
station_lcd.print("Tijd ingesteld");
station_lcd.line2();
tekst = "";
str.putlong(tekst,hour);
str.putstring(tekst,":");
str.putlong(tekst,minute);
station_lcd.print(tekst);
sleep 2000;
}
//------------------------------------------
function f_kies_programma() //stel programma in
//------------------------------------------
{
programma = 0;
station_lcd.clear(); // blanco scherm
station_lcd.print("Kies programma :");
station_lcd.line2();
programma=station_io.getcode();
sleep 1000;
} // einde functie
//------------------------------------------
function f_start_programma() //start programma
//------------------------------------------
{
f_kies_programma();
station_lcd.clear();
tekst = "S1 : ";
str.putlong(tekst,tijd_1[programma]);
str.putstring(tekst," S2 : ");
str.putlong(tekst,tijd_2[programma]);
station_lcd.print(tekst);
station_lcd.line2();
station_lcd.print("Enter=OK C=Stop");
loop
{
nummer = station_io.getkey(); // wacht op toets
if nummer == 13 return; // stop
if nummer == 14 break; // enter
} // einde loop
for sectie = 1 ... 2;
{
station_lcd.clear();
tekst = "Beregen sectie ";
str.putlong(tekst,sectie);
station_lcd.print(tekst);
minute=0;
second=0;
station_io.RELon(sectie);
station_lcd.cursoroff();
station_lcd.clear2();
for minute = 1 ... tijd_1[programma]
{
for second = 1 ... 60
{
station_lcd.cursorpos(2,0);
tekst = "tijd: ";
str.putlong(tekst,tijd_1[programma]-minute);
str.putstring(tekst," min ");
str.putlong(tekst,60-second);
str.putstring(tekst," sec");
station_lcd.print(tekst);
sleep 1000;
}
}
station_io.RELoff(sectie);
}
}// einde functie
//------------------------------------------
function f_stel_tijden_in() //Stel regentijden in
//------------------------------------------
{
f_kies_programma();
station_lcd.clear();
station_lcd.print("Tijd instellen");
station_lcd.line2();
station_lcd.cursorpos(2,3);
station_lcd.print("minuten S1");
station_lcd.cursorpos(2,0);
tijd_1[programma]=station_io.getcode();
sleep 1000;
station_lcd.clear2();
station_lcd.cursorpos(2,3);
station_lcd.print("minuten S2");
station_lcd.cursorpos(2,0);
tijd_2[programma]=station_io.getcode();
sleep 1000;
station_lcd.clear();
station_lcd.print("Ingesteld");
station_lcd.line2();
tekst = "S1 : ";
str.putlong(tekst,tijd_1[programma]);
str.putstring(tekst," S2 : ");
str.putlong(tekst,tijd_2[programma]);
station_lcd.print(tekst);
}// einde functie
//-------------------------------------------
thread main // main loop
//-------------------------------------------
{
station_io.init(); // initialiseer I/O
station_lcd.init(); // initialiseer LCD
//run noodstop;
f_initialiseer(); // stel tijdsduren in
f_input_klok(); // stel tijd in
station_lcd.clear();
station_lcd.print("Kies een functie");
station_lcd.line2();
station_lcd.print("F1=Start programma F2=Stel tijden in");
loop
{
nummer = station_io.getkey(); // wacht op toets
if nummer == 10 f_start_programma(); // F1 Start programma
if nummer == 11 f_stel_tijden_in(); // F2 Stel programma in
} // einde loop
quit 100;
} // einde programma |