-
Notifications
You must be signed in to change notification settings - Fork 1
/
Goal-Keeper Ball Tracker.bas
259 lines (218 loc) · 4.53 KB
/
Goal-Keeper Ball Tracker.bas
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
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
'########################### GUARDA REDES N3 2016 INFRAVERMELHOS #########################################
setfreq m64
let b10=149'149 'AFINAÇÂO para anular as reflexões nos cantos
let b11=b10+1
let b14=b10
let b15=b14+1
let b16=b10-9
let b17=b10-5
inicio:
readadc 10,b0 '0
readadc 8,b1 '1
readadc 7,b2 '2
readadc 6,b3 '3
readadc 5,b4 '4
readadc 4,b5 '5
readadc 1,b6 '6 (readadc 3) foi alterado para readadc 1
readadc 2,b7 '7
'estão desligados os sensores nas entradas 0 e 4
' 1 2 3 5 6 7 01234567
if b1>b10 and b2>b10 and b3>b10 and b5>b10 and b6>b10 and b7>b10 then centro'apagado
if b1<b11 and b2>b10 and b3>b10 and b5>b10 and b6>b10 and b7<b11 then centro'frente_01000001
'if b0<b11 and b1>b10 and b2>b10 and b3>b10 and b5>b10 and b6>b10 and b7>b10 then frente
'if b0<b11 and b1<b11 and b2>b10 and b3>b10 and b5>b10 and b6>b10 and b7>b10 then esquerdo_1
'if b0<b11 and b1>b10 and b2>b10 and b3>b10 and b5>b10 and b6>b10 and b7<b11 then direito_1
if b1<b11 and b2>b10 and b3>b10 and b5>b10 and b6>b10 and b7>b10 then esquerdo '01000 esquerda_01000000
if b1>b10 and b2>b10 and b3>b10 and b5>b10 and b6>b10 and b7<b11 then direito ' 00010 direita_00000001
if b1<b11 and b2<b11 and b3>b10 and b5>b10 and b6>b10 and b7>b10 then esquerda_r_01100000
if b1>b10 and b2<b11 and b3>b10 and b5>b10 and b6>b10 and b7>b10 then esquerda_r_00100000
if b1>b10 and b2<b11 and b3<b11 and b5>b10 and b6>b10 and b7>b10 then esquerda_r_00110000
if b1>b10 and b2>b10 and b3<b11 and b5>b10 and b6>b10 and b7>b10 then esquerda_r_00010000
if b1>b10 and b2>b10 and b3>b10 and b5<b11 and b6>b10 and b7>b10 then direita_r_00000100
if b1>b10 and b2>b10 and b3>b10 and b5<b11 and b6<b11 and b7>b10 then direita_r_00000110
if b1>b10 and b2>b10 and b3>b10 and b5>b10 and b6<b11 and b7>b10 then direita_r_00000010 '««««
if b1>b10 and b2>b10 and b3>b10 and b5>b10 and b6<b11 and b7<b11 then direita_r_00000011
goto inicio
centro:
if b1>b14 and b0>b14 and b7>b14 then apagado
if b1>b14 and b0<b15 and b7>b14 then frente11
if b1<b15 and b0>b14 and b7>b14 then frente'esq
if b1>b14 and b0>b14 and b7<b15 then frente'dir
if b1<b14 and b0<b15 and b7>b15 then esquerdo_1
if b1>b15 and b0<b15 and b7<b14 then direito_1
goto inicio
frente11:
if b0<131 then xuto
if b0>130 and b0<b16 then frente
if b0>b16 then apagado
goto inicio
xuto:
low b.6'0
high c.5'1
high c.4'2
high c.0'3
low b.7'4
'01110
goto inicio
apagado:
low b.6'0
low c.5'1
low c.4'2
low c.0'3
low b.7'4
'00000
goto inicio
frente:
low b.6'0
low c.5'1
high c.4'2
low c.0'3
low b.7'4
'00100
goto inicio
'###########################
esquerda_01000000:
low b.6'0
low c.5'1
low c.4'2
high c.0'3
low b.7'4
'01000
goto inicio
direita_00000001:
low b.6'0
high c.5'1
low c.4'2
low c.0'3
low b.7'4
'00010
goto inicio
esq:
if b1<b16 then esq_1
if b1>b16 then apagado
goto inicio
esq_1:
low b.6'0
low c.5'1
low c.4'2
high c.0'3
low b.7'4
'01000
goto inicio
esquerdo:
low b.6'0
low c.5'1
low c.4'2
high c.0'3
low b.7'4
'01000
goto inicio
dir:
if b7<b16 then dir_1
if b7>b16 then apagado
goto inicio
dir_1:
low b.6'0
high c.5'1
low c.4'2
low c.0'3
low b.7'4
'00010
goto inicio
direito:
low b.6'0
high c.5'1
low c.4'2
low c.0'3
low b.7'4
'00010
goto inicio
'##############################
esquerdo_1:
low b.6'0
low c.5'1
low c.4'2
high c.0'3
low b.7'4
'01100
goto inicio
direito_1:
low b.6'0
high c.5'1
low c.4'2
low c.0'3
low b.7'4
'00110
goto inicio
frente_01000001:
low b.6'0
high c.5'1
low c.4'2
high c.0'3
low b.7'4
'01010
goto inicio
esquerda_r_00100000:
low b.6'0
low c.5'1
low c.4'2
low c.0'3
high b.7'4
'10000
goto inicio
esquerda_r_01100000:'nn
low b.6'0
low c.5'1
low c.4'2
high c.0'3
high b.7'4
'11000
goto inicio
esquerda_r_00110000:
low b.6'0
low c.5'1
high c.4'2
high c.0'3
high b.7'4
'11100
goto inicio
direita_r_00000010:
high b.6'0
low c.5'1
low c.4'2
low c.0'3
low b.7'4
'00001
goto inicio
direita_r_00000011: 'nnn
high b.6'0
high c.5'1
low c.4'2
low c.0'3
low b.7'4
'00011
goto inicio
direita_r_00000110:
high b.6'0
high c.5'1
high c.4'2
low c.0'3
low b.7'4
'00111
goto inicio
esquerda_r_00010000:
low b.6'0
low c.5'1
high c.4'2
low c.0'3
high b.7'4
'10100
goto inicio
direita_r_00000100:
high b.6'0
low c.5'1
high c.4'2
low c.0'3
low b.7'4
'00101
goto inicio