Datasheet
Page 74· Applied Robotics with the SumoBot
PAUSE 100
FREQOUT LedSpeaker, 100, 4000
NEXT
PAUSE 1000 ' 1 second between beeps
IF pbSense = 0 THEN ' Button released?
WRITE ModeSelect, temp ' Record mode to EEPROM
EXIT ' Exit FOR...NEXT loop
ENDIF
NEXT
RETURN
Your Turn - Testing the New Program
There should be two ways to set the program mode. The first is to hold down the
pushbutton as you download the program. The other is to hold the pushbutton down as
you press and release the Reset button. Since EEPROM memory is used to store the
mode, it's nonvolatile, meaning that disconnecting power or pressing and releasing Reset
cannot erase the value. You can also change the mode value by simply holding down the
pushbutton as you press and release Reset again.
√ Hold down the pushbutton (not the Reset button!) as you download
ResetAndStartMode.bs2 to your SumoBot.
√ Keep holding the button down until the SumoBot makes three consecutive beeps,
then let go.
√ Press and release the Reset button.
√ Verify that the SumoBot is operating in mode three.
√ Don't hold the pushbutton down as you press and release the Reset button a few
more times to verify that the SumoBot retains the mode three setting.
√ Press and hold the pushbutton, then press/release the Reset button.
√ Keep holding the pushbutton until after four consecutive beeps, then let go.
√ Press and release the Reset button again, and verify that the SumoBot has now
retained mode four.
√ Download the program one more time, and verify that the mode setting has been
erased (because the
ModeSelect DATA directive writes a 0 to ModeSelect.
√ Try also changing
ModeSelect DATA 0 to just ModeSelect DATA. That way,
the program won't overwrite the mode you chose whenever you download it.
You pretty much always have the choice of making the
DATA directive pre-store values in
EEPROM, or just having them reserve the space.