FREQOUT 4, 2000, 3000
FOR counter = 1 TO 122
PULSOUT 12, 650
PAUSE 20
NEXT
FOR counter = 1 TO 40
PULSOUT 12, 750
PAUSE 20
NEXT
FOR counter = 1 TO 122
PULSOUT 12, 850
PAUSE 20
NEXT
FREQOUT 4, 500, 3500
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
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
rtPulseWidth
VAR
pulseCount
VAR
counter
VAR
DO
DEBUG "Enter left servo pulse width: "
DEBUGIN DEC ltPulseWidth
DEBUG "Enter right servo pulse width: "
DEBUGIN DEC rtPulseWidth
DEBUG "Enter number of pulses:
DEBUGIN DEC pulseCount
FOR counter = 1 TO pulseCount
Chapter 3: Assemble and Test Your Boe-Bot · Page 121
' Signal start of program.
' Clockwise just under 3 seconds.
' Stop one second.
' Counterclockwise three seconds.
' Signal end of program
loop with two servo
PULSOUT
Word
' Left servo pulse width
Word
' Right servo pulse width
Byte
' Number of pulses to servo
Word
' Loop counter
' Enter values in Debug
' Terminal
"
' Send specific number of pulses
commands must be
Need help?
Do you have a question about the Boe-Bot and is the answer not in the manual?
Questions and answers