Datasheet

Page 58· Applied Robotics with the SumoBot
END
' -----[ Subroutine - Reset ]-------------------------------------------------
Reset:
READ RunStatus, temp ' Byte @RunStatus -> temp
temp = temp + 1 ' Increment temp
WRITE RunStatus, temp ' Store new value for next time
IF (temp.BIT0 = 1) THEN ' Examine temp.BIT0
DEBUG CLS, "Press/release Reset", CR, ' 1 -> end, 0 -> keep going
"button..."
END
ELSE
DEBUG CR, "Program running..."
ENDIF
RETURN
' -----[ Subroutine - Start_Delay ]-------------------------------------------
Start_Delay:
FOR counter = 1 TO 5 ' 5 beeps, 1/second
PAUSE 900
FREQOUT LedSpeaker, 100, 3000
NEXT
RETURN
Your Turn
Try modifying the program so that it displays the number of times you have
pressed and released the Reset button.
ACTIVITY #4: PUSHBUTTON, LED, AND SPEAKER
The LED and speaker can be used as status indicators. Primarily, the beeping and LED
blinking helps you know when the SumoBot is doing its 5 second countdown. These
indicators are also useful for trouble-shooting SumoBot behavior problems. The single
pushbutton can be used along with the indicators to adjust the SumoBot's behavior
between sumo rounds and even select between different operation modes.