Chapter 2: SumoBot Locomotion · Page 15
' SumoBot_2.1_Motor_Align.BS2
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ I/O Definitions ]-------------------------------------------------
LMotor PIN 13 ' left servo motor
RMotor PIN 12 ' right servo motor
' -----[ Constants ]-------------------------------------------------------
LStop CON 750 ' left motor stop
RStop CON 750 ' right motor stop
' -----[ Initialization ]--------------------------------------------------
Reset:
LOW LMotor ' initialize motor outputs
LOW RMotor
' -----[ Program Code ]----------------------------------------------------
Main:
DO
PULSOUT LMotor, LStop ' stop left
PULSOUT RMotor, RStop ' stop right
PAUSE 20
LOOP
END
Move the SumoBot power switch to position 2, and then download the code using the
Run command from the Run menu, or by pressing the ► button on the toolbar. As soon
as the program is downloaded, watch for wheel movement. If either motor turns, insert a
small screwdriver into the adjustment port of the servo and adjust the centering
potentiometer until the motor stops. Figure 2.5 shows the location of the servo
adjustment ports.