Datasheet
Page 214· Applied Robotics with the SumoBot
#SELECT DEBUG_MODE
#CASE 0
DEBUG "DEBUG_MODE is zero."
#CASE 1
DEBUG "DEBUG_MODE is one."
#CASE 2
DEBUG "DEBUG_MODE is two."
#ENDSELECT
Because LED_MODE is 1, the code inside the commands nested in the #IF LED_MODE = 1
#THEN
code block will become part of the program. The code inside the #ELSE block will
be ignored, unless of course, you change the
#DEFINE LED_MODE directive to zero.
' -----[ Main Routine ]------------------------------------------------
DO
DEBUG CRSRX, 0, ? counter
counter = counter + 1
#IF LED_MODE = 1 #THEN
DEBUG "LED state = ", BIN1 counter.BIT0, CRSRUP
TOGGLE LedSpeaker
PAUSE 200
#ELSE
DEBUG "LED_MODE disabled", CRSRUP
PAUSE 100
#ENDIF
LOOP
Example Program: CompilerDirectives.bs2
CompilerDirectives.bs2 can actually be six different programs. That's because it has
conditional compiler directives for three different DEBUG_MODEs and two different
LED_MODEs. This gives you six different combinations of DEBUG_MODE and LED_MODE.
√ Based on the
LED_MODE and DEBUG_MODE #DEFINES, predict what
CompilerDirectives.bs2 is going to do when you download it to the BASIC
Stamp.