Parallax Boe-Bot Student Manual page 296

Hide thumbs Also See for Boe-Bot:
Table of Contents

Advertisement

Page 282 · Robotics with the Boe-Bot
Move the sheet of paper too close to the Boe-Bot, and it should back up, away
from the paper.
' -----[ Title ]--------------------------------------------------------------
' Robotics with the Boe-Bot - FollowingBoeBot.bs2
' Boe-Bot adjusts its position to keep objects it detects in zone 2.
' {$STAMP BS2}
' {$PBASIC 2.5}
DEBUG "Program Running!"
' -----[ Constants ]----------------------------------------------------------
Kpl
CON
Kpr
CON
SetPoint
CON
CenterPulse
CON
' -----[ Variables ]----------------------------------------------------------
freqSelect
VAR
irFrequency
VAR
irDetectLeft
VAR
irDetectRight
VAR
distanceLeft
VAR
distanceRight
VAR
pulseLeft
VAR
pulseRight
VAR
' -----[ Initialization ]-----------------------------------------------------
FREQOUT 4, 2000, 3000
' -----[ Main Routine ]-------------------------------------------------------
DO
GOSUB Get_Ir_Distances
' Calculate proportional output.
pulseLeft =
SetPoint - distanceLeft
pulseRight = SetPoint - distanceRight * Kpr + CenterPulse
GOSUB Send_Pulse
LOOP
' -----[ Subroutine - Get IR Distances ]--------------------------------------
-35
35
2
750
Nib
Word
Bit
Bit
Nib
Nib
Word
Word
* Kpl + CenterPulse
' Stamp directive.
' PBASIC directive.

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the Boe-Bot and is the answer not in the manual?

Questions and answers

Table of Contents

Save PDF