blob: 3b6a7653f23b965fcfc94f77c003b02d74d866a5 (
plain)
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
|
sem=0 # make sure this one is global
def task_move_square():
while True:
while (sem == 1):
pass
sem = 1
OnFwd(OUT_AC, 75)
sem = 0
Wait(1000)
while sem==1:
pass
sem = 1
OnRev(OUT_C, 75)
sem = 0
Wait(850)
def task_submain():
SetSensor(IN_1, SENSOR_TOUCH)
while True:
if SENSOR_1 == 1:
while (sem == 1):
pass
sem = 1
OnRev(OUT_AC, 75); Wait(500)
OnFwd(OUT_A, 75); Wait(850)
sem = 0
def main():
sem = 0
Precedes(task_move_square, task_submain)
|