Datasheet

Page 72ยท Applied Robotics with the SumoBot
' -----[ I/O Definitions ]----------------------------------------------------
LedSpeaker PIN 5 ' P5 controls LED & speaker
' ---> Pasted from PushbuttonMode.bs2 <---
pbSense PIN 6 ' Pushbutton connected to P6
' -----[ Variables ]----------------------------------------------------------
temp VAR Word ' Temporary variable
counter VAR Byte ' Loop counting variable.
' -----[ EEPROM Data ]--------------------------------------------------------
RunStatus DATA 0 ' Run status EEPROM byte
' ---> Pasted from PushbuttonMode.bs2 <---
ModeSelect DATA 0 ' Program
' -----[ Initialization ]-----------------------------------------------------
' ---> Pasted from PushbuttonMode.bs2 <---
IF pbSense = 1 THEN GOSUB Mode_Select ' Call Mode_Select subroutine
GOSUB Reset ' Wait for Reset press/release
GOSUB Start_Delay ' 5 Second delay
' -----[ Main Routine ]-------------------------------------------------------
' ---> Pasted from PushbuttonMode.bs2 (ModeTest routine)<---
ModeTest:
READ ModeSelect, temp ' Fetch mode from EEPROM
IF temp = 0 THEN ' Mode = 0 -> no mode selected
DEBUG CR, "No mode selected",
CR, "Hold down pushbutton",
CR, "then press/release",
CR, "Reset button."
ELSE ' mode <> 0 -> display mode
DEBUG CR, CR, "Operating in mode ", CR ' Mode Message
SELECT temp ' Select mode value to display
CASE 1
DEBUG "one"
CASE 2
DEBUG "two"
CASE 3
DEBUG "three"
CASE 4
DEBUG "four"
CASE 5