Datasheet
Chapter 1: Mechanical Adjustments · Page 19
√ Compare the results of the two trials and determine which program gives the
SumoBot better performance.
' -----[ Program Description ]------------------------------------------------
' Applied Robotics with the SumoBot - ForwardLowTimeTest.bs2
' SumoBot goes forward indefinitely. Use the Reset button to start and stop
' the forward motion.
'
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ I/O Definitions ]---------------------------------------------------
ServoLeft PIN 13 ' Left servo connected to P13
ServoRight PIN 12 ' Right servo connected to P12
' -----[ EEPROM Data ]--------------------------------------------------------
RunStatus DATA 0 ' Start with program not running
' -----[ Constants ]----------------------------------------------------------
LowTime CON 20 ' Try 1 SumoBot with 20 ms pulses
' Try the other with 40 ms pulses
' -----[ Variables ]----------------------------------------------------------
temp VAR Byte ' Temporary variable
counter VAR Byte ' FOR...NEXT loop counter
' -----[ Initialization ]-----------------------------------------------------
DEBUG CLS ' Clear the Debug Terminal
READ RunStatus, temp ' read current status
temp = ~temp ' invert status
WRITE RunStatus, temp ' save for next reset
IF (temp > 0) THEN ' 0 -> End, 1 -> Main routine
DEBUG "Press/release Reset..."
END
ENDIF
DEBUG "Main program running...", CR ' Display program status
' -----[ Main Routine ]-------------------------------------------------------
DO ' Forward pulses indefinitely
PULSOUT ServoLeft, 850
PULSOUT ServoRight, 650
PAUSE LowTime