Code:
'--------------------------------------------
'--- WEGSTRECKENZÄHLER ---
'--------------------------------------------
gosub CLR_DISTANCE:gosub LEDSOFF:gosub move_fwd
#NO_TASK
pause 5:SYS COMNAV_STATUS
gosub R_DISTANCE
if LBYTE=32 then goto kreis
if LBYTE=115 then goto stop
goto NO_TASK
'--------------------------------------------
#stop
gosub LED4ON:SYS FWDR:SYS FWDL:SPEED_L=0:SPEED_R=0:end
#kreis
SYS FWDR:SYS FWDL:SPEED_L=255:SPEED_R=45:return
#move_fwd
SYS FWDR:SYS FWDL:SPEED_L=155:SPEED_R=155:return
'---------------------------------------------
Code:
#loop
if ANZEIGEMODE=0 then goto COMMAND_REQUEST_2
'---------- KOMMANDO ABFRAGE 1 -----------------
#COMMAND_REQUEST_1
pause 2:SYS COMNAV_STATUS
if IR_F =off then goto loop
gosub GET_IRDATA:goto EX_COMMAND
'---------- KOMMANDO ABFRAGE 2 -----------------
#COMMAND_REQUEST_2
pause 5:gosub LEDSOFF:SYS COMNAV_STATUS
if IR_F =off then goto loop
gosub LED1ON:gosub GET_IRDATA
'---------- KOMMANDO INTERPRETER --------------
#EX_COMMAND
if HBYTE=&HFF then goto loop
if LBYTE=13 then goto stop
if LBYTE=32 then goto forward
if LBYTE=33 then goto back
if LBYTE=17 then goto rotleft
if LBYTE=16 then goto rotright
goto loop
#anzeige
if ANZEIGEMODE=0 then ANZEIGEMODE=1 else ANZEIGEMODE=0
pause 5:gosub GET_IRDATA:goto loop
'----------------------------------------------
#stop
SYS FWDR:SYS FWDL:SPEED_L=0:SPEED_R=0:SPEED=0:MODE=0:goto loop
#rotleft
MODE=3:SYS ROTL:SPEED_L=SPEED:SPEED_R=SPEED:goto loop
#rotright
MODE=3:SYS ROTR:SPEED_L=SPEED:SPEED_R=SPEED:goto loop
'-----------------------------------------------
#forward
if MODE=3 then goto FWD
if MODE=2 then goto REV_SLOWER
if SPEED=250 then SPEED=240
SPEED=SPEED+10:goto FWD
#FWD_SLOWER
SPEED=SPEED-10
if SPEED=20 then goto REV
#FWD
MODE=1:SYS FWDL:SYS FWDR:SPEED_L=SPEED:SPEED_R=SPEED:goto loop
#back
if MODE=3 then goto REV
if MODE=1 then goto FWD_SLOWER
if SPEED=250 then SPEED=240
SPEED=SPEED+10:goto REV
#REV_SLOWER
SPEED=SPEED-10
if SPEED=20 then goto FWD
#REV
MODE=2:SYS REVL:SYS REVR:SPEED_L=SPEED:SPEED_R=SPEED:goto loop
Das sind die 2 teilprogramme die ich verbinden möchte.
Muss das ganze dann so aussehen???
Kann es leider grad nicht nachprüfen da ich den Robby nicht zur Hand habe.
Code:
gosub CLR_DISTANCE
#loop
pause 5:SYS COMNAV_STATUS
gosub L_DISTANCE
WEG=LBYTE
if WEG>33 then goto circle
if ANZEIGEMODE=0 then goto COMMAND_REQUEST_2
'---------- KOMMANDO ABFRAGE 1 -----------------
#COMMAND_REQUEST_1
pause 2:SYS COMNAV_STATUS
if IR_F =off then goto loop
gosub GET_IRDATA:goto EX_COMMAND
'---------- KOMMANDO ABFRAGE 2 -----------------
#COMMAND_REQUEST_2
pause 5:gosub LEDSOFF:SYS COMNAV_STATUS
if IR_F =off then goto loop
gosub LED2ON:gosub LED3ON:gosub GET_IRDATA
'---------- KOMMANDO INTERPRETER --------------
#EX_COMMAND
if HBYTE=&HFF then goto loop
if LBYTE=33 then goto stop
if LBYTE=32 then goto forward
if LBYTE=17 then goto rotleft
if LBYTE=16 then goto rotright
goto loop
'----------------------------------------------
#forward
MODE=1:SYS FWDL:SYS FWDR:SPEED_L=100:SPEED_R=100:goto loop
#stop
SYS FWDR:SYS FWDL:SPEED_L=0:SPEED_R=0:SPEED=0:MODE=0:goto loop
#rotleft
gosub LED4ON:pause 10:gosub LED4OFF:pause 10:beep 250,10,0
MODE=3:SYS ROTL:SPEED_L=70:SPEED_R=70:goto loop
#rotright
gosub LED1ON:pause 10:gosub LED1OFF:pause 10:beep 250,10,0
MODE=3:SYS ROTR:SPEED_L=70:SPEED_R=70:goto loop
#circle
SYS FWDL:SYS FWDR:SPEED_L=200:SPEED_R=29:pause 660
SYS FWDL:SYS FWDR:SPEED_L=0:SPEED_R=0:gosub LEDSOFF:end
Lesezeichen