28125 Parallax Inc, 28125 Datasheet - Page 152

TEXT ROBOTICS

28125

Manufacturer Part Number
28125
Description
TEXT ROBOTICS
Manufacturer
Parallax Inc
Datasheet

Specifications of 28125

Title
Robotics with the Boe-Bot
Product
Microcontroller Accessories
Lead Free Status / RoHS Status
Not applicable / Not applicable
Recall from Chapter 2, Activity #5 that
higher number to a lower number. You can use this to ramp the speed back down again
by using
FOR…NEXT
Example Program: StartAndStopWithRamping.bs2
' -----[ Title ]--------------------------------------------------------------
' Robotics with the Boe-Bot - StartAndStopWithRamping.bs2
' Ramp up, go forward, ramp down.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
pulseCount
' -----[ Initialization ]----------------------------------------------------
FREQOUT 4, 2000, 3000
' -----[ Main Routine ]-------------------------------------------------------
' Ramp up forward.
FOR pulseCount = 1 TO 100
PULSOUT 13, 750 + pulseCount
PULSOUT 12, 750 - pulseCount
PAUSE 20
pulseCount
FOR pulseCount = 1 TO 100
NEXT
Enter, save, and run StartAndStopWithRamping.bs2.
Verify that the Boe-Bot gradually accelerates to full speed, maintains full speed
for a while, and then gradually decelerates to a full stop.
FOR pulseCount = 100 TO 1
loops to ramp up to full speed, then ramp back down.
PULSOUT 13, 750 + pulseCount
PULSOUT 12, 750 - pulseCount
PAUSE 20
VAR
Word
VAR
Word
FOR…NEXT
. Here is an example program that uses
loops can also count downward from a
' FOR...NEXT loop counter.
' Signal program start/reset.
' Loop ramps up for 100 pulses.
' Pulse = 1.5 ms + pulseCount.
' Pulse = 1.5 ms – pulseCount.
' Pause for 20 ms.
1, 2, 3,
…100
Figure 4-4
Ramping
Example

Related parts for 28125