define x byte
define sensor1 port[1]
define sensor2 port[5]
define sensor3 port[16]
#loop
gosub fahren
wait not sensor1 and sensor2 and sensor3
gosub ausweichen
goto loop
#fahren
'Motorstrom
print "#rmi";

ut 2: put 58
pause 20
'beide Motoren ein
print "#rmo"; : put 2
pause 20
'beide motoren rechts
print "#rmd";

ut 2: put 0
pause 20
'geschwindigkeit
print "#rmg";

ut 2: put 15
pause 20
'endlos drehen
print "#rme"; : put 2
wait not sensor1 and sensor2 and sensor3
gosub ausweichen
#ausweichen
randomize timer
x=rand
if x<128 then gosub rechts else gosub links
return
#links
'Motorstrom
print "#rmi";

ut 2: put 58
pause 20
'beide Motoren ein
print "#rmo"; : put 2
pause 20
'Linker motor nach links
print "#rmd";

ut 0: put 0
'rechter motor nach rechts
print "#rmd";

ut 1: put 1
pause 20
'geschwindigkeit
print "#rmg";

ut 2: put 15
pause 20
'endlos drehen
print "#rme"; : put 2
wait sensor1 and sensor2 and sensor3
goto loop
#rechts
'Motorstrom
print "#rmi";

ut 2: put 58
pause 20
'beide Motoren ein
print "#rmo"; : put 2
pause 20
'Linker motor nach links
print "#rmd";

ut 0: put 1
'rechter motor nach rechts
print "#rmd";

ut 1: put 0
pause 20
'geschwindigkeit
print "#rmg";

ut 2: put 15
pause 20
'endlos drehen
print "#rme"; : put 2
pause 20
wait sensor1 and sensor2 and sensor3
goto loop
Lesezeichen