Datasheet
Page 218ยท Applied Robotics with the SumoBot
' -----[ Variables ]----------------------------------------------------------
.
.
.
#IF DEBUG_MODE = 1 #THEN
state VAR Nib ' State machine value
#ENDIF
All the sensor, state, and maneuver values are displayed in a table, so a table heading
is added to the Initialization section.
' -----[ Initialization ]-----------------------------------------------------
.
.
.
#IF DEBUG_MODE = 1 #THEN
DEBUG CLS, ' Display table heading
"Sensors State Maneuver", CR,
"-------- -------- --------", CR
#ENDIF
Since all roads lead to the Servos_And_Sensors subroutine, that's the most logical place
to put some code for displaying what's happening inside the program. In this example,
the command
GOSUB Display_All has been placed at the beginning of the subroutine.
Remember, the subroutine call only becomes part of the program when
DEBUG_MODE = 1.
' -----[ Subroutine - Servos_And_Sensors ]------------------------------------
Servos_And_Sensors:
#IF DEBUG_MODE = 1 #THEN
GOSUB Display_All ' Call Display_All subroutine
#ENDIF
.
.
.
Since each subroutine represents a different operating 'state' for the SumoBot, code has to
be added to the beginning of each one to set the value of the state variable. Here are
some examples.
' -----[ Subroutine - Avoid_Tawara_Left ]-------------------------------------
Avoid_Tawara_Left:
#IF DEBUG_MODE = 1 #THEN state = ATL #ENDIF
.