42
User Manual
Copyright ©2003 A7 Engineering, Inc.
'-----[Main Code]-----------------------------------------------
Main:
'Verify the connection is still up before each loop
IF in5 = 0 THEN Connect
GOSUB
Read_IR_Sensors
BRANCH irBits,[Hold, Turn_Right, Turn_left, Move_Fwd]
Move_Fwd:
SEROUT
1,84,["3"]
PULSOUT
LMotor,LFwdFast
PULSOUT
RMotor,RFwdFast
GOTO
Main
Turn_Right:
SEROUT
1,84,["1"]
PULSOUT
LMotor,LFwdFast
PULSOUT
RMotor,RRevFast
GOTO
Main
Turn_Left:
SEROUT
1,84,["2"]
PULSOUT
LMotor,LRevFast
PULSOUT
RMotor,RFwdFast
GOTO
Main
Hold:
GOTO
Main
'-----[Subroutines]---------------------------------------------
Read_IR_Sensors:
FREQOUT
LfIrOut,1,38500
irLeft = ~LfIrIn
FREQOUT
RtIrOut,1,38500
irRight = ~RtIrIn