Robotics with the Boe-Bot text v2.2
Chapter 3: Assemble and Test Your Boe-Bot · Page 121 
FREQOUT 4, 2000, 3000 ' Signal start of program. 
FOR counter = 1 TO 122 ' Clockwise just under 3 seconds. 
 PULSOUT 12, 650 
 PAUSE 20 
NEXT 
FOR counter = 1 TO 40 ' Stop one second. 
 PULSOUT 12, 750 
 PAUSE 20 
NEXT 
FOR counter = 1 TO 122 ' Counterclockwise three seconds. 
 PULSOUT 12, 850 
 PAUSE 20 
NEXT 
FREQOUT 4, 500, 3500 ' Signal end of program 
END 
P2.  To solve this problem, TestServoSpeed.bs2 must be expanded to receive three 
pieces of data: left servo pulsewidth, right servo pulsewidth, and number of 
pulses. Then, a FOR…NEXT loop with two servo PULSOUT commands must be 
added to actually move the servo motors. Furthermore, all variables must be 
declared in the beginning of the program. An example solution is shown below. 
' Robotics with the Boe-Bot - Ch03Prj02_DebuginMotion.bs2 
' Enter servo pulsewidth & duration for both wheels via Debug Terminal. 
'{$STAMP BS2} 
'{$PBASIC 2.5} 
ltPulseWidth VAR Word ' Left servo pulse width 
rtPulseWidth VAR Word ' Right servo pulse width 
pulseCount VAR Byte ' Number of pulses to servo 
counter VAR Word ' Loop counter 
DO 
 DEBUG "Enter left servo pulse width: " ' Enter values in Debug 
 DEBUGIN DEC ltPulseWidth ' Terminal 
 DEBUG "Enter right servo pulse width: " 
 DEBUGIN DEC rtPulseWidth 
 DEBUG "Enter number of pulses: " 
 DEBUGIN DEC pulseCount 
 FOR counter = 1 TO pulseCount ' Send specific number of pulses 










