28125 Parallax Inc, 28125 Datasheet - Page 306

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
Kpr
SetPoint
CenterPulse
' -----[ Variables ]----------------------------------------------------------
freqSelect
irFrequency
irDetectLeft
irDetectRight
distanceLeft
distanceRight
pulseLeft
pulseRight
' -----[ Initialization ]-----------------------------------------------------
FREQOUT 4, 2000, 3000
' -----[ Main Routine ]-------------------------------------------------------
DO
LOOP
' -----[ Subroutine - Get IR Distances ]--------------------------------------
Get_Ir_Distances:
GOSUB Get_Ir_Distances
' Calculate proportional output.
pulseLeft =
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
GOSUB Send_Pulse
distanceLeft = 0
distanceRight = 0
FOR freqSelect = 0 TO 4
NEXT
RETURN
LOOKUP freqSelect,[37500,38250,39500,40500,41500], irFrequency
FREQOUT 8,1,irFrequency
irDetectLeft = IN9
distanceLeft = distanceLeft + irDetectLeft
FREQOUT 2,1,irFrequency
irDetectRight = IN0
distanceRight = distanceRight + irDetectRight
CON
CON
CON
VAR
VAR
VAR
VAR
VAR
VAR
VAR
VAR
SetPoint - distanceLeft
-35
3
750
Nib
Word
Bit
Bit
Nib
Nib
Word
Word
* Kpl + CenterPulse
' Change from 35 to -35
' Change from 2 to 3.

Related parts for 28125