by Ray » Tue Sep 26, 2006 4:13 pm
by Ray
Tue Sep 26, 2006 4:13 pm
Hi, although it may be too late,
I thing one of the serious problem in the program is the "RETURN" should be replaced by "GOTO MAIN".
RETURN command is used for GOSUB .... RETURN only!
the program pointer will go to unknown position in this case.
Your code:
'================================================
MAIN:
RC4 = RCIN(3)
RC2 = RCIN(1)
'RC Walk
IF RC4 >= 125 THEN ' RIGHT TURN
GOSUB right_turn
GOSUB standard_pose
ENDIF
IF RC4 <= 75 AND RC4 > 10 THEN 'LEFT TURN
GOSUB left_turn
GOSUB standard_pose
ENDIF
IF RC2 >= 125 THEN ' BACKWARD
GOSUB backward_walk
GOSUB standard_pose
ENDIF
IF RC2 <= 75 AND RC2 > 10 THEN ' FORWARD
GOSUB forward_walk
GOSUB standard_pose
ENDIF
RETURN ==============> GOTO MAIN (CHANGE HERE !!)
'================================================
[/quote]
Hi, although it may be too late,
I thing one of the serious problem in the program is the "RETURN" should be replaced by "GOTO MAIN".
RETURN command is used for GOSUB .... RETURN only!
the program pointer will go to unknown position in this case.
Your code:
'================================================
MAIN:
RC4 = RCIN(3)
RC2 = RCIN(1)
'RC Walk
IF RC4 >= 125 THEN ' RIGHT TURN
GOSUB right_turn
GOSUB standard_pose
ENDIF
IF RC4 <= 75 AND RC4 > 10 THEN 'LEFT TURN
GOSUB left_turn
GOSUB standard_pose
ENDIF
IF RC2 >= 125 THEN ' BACKWARD
GOSUB backward_walk
GOSUB standard_pose
ENDIF
IF RC2 <= 75 AND RC2 > 10 THEN ' FORWARD
GOSUB forward_walk
GOSUB standard_pose
ENDIF
RETURN ==============> GOTO MAIN (CHANGE HERE !!)
'================================================
[/quote]