Parallax Boe-Bot Student Manual page 281

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

Advertisement

ENDIF
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
PAUSE 15
' Check IRs again in case object is moving
GOSUB Check_IRs
LOOP
' -----[ Subroutines ] ------------------------------------------------
Check_IRs:
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
IrDetectRight = IN0
RETURN
P3. The key to solving this problem is to combine "FastIrRoaming.bs2" and
"IrInterferenceSniffer.bs2" in a single program.
' -----[ Title ]-------------------------------------------------------
' Robotics with the Boe-Bot - RoamAndSniffBoeBot.bs2
' Boe-Bot roams around and sounds alarm when IR detected.
' {$STAMP BS2}
' {$PBASIC 2.5}
' -----[ Variables ]---------------------------------------------------
irDetectLeft
VAR
irDetectRight
VAR
pulseLeft
VAR
pulseRight
VAR
counter
VAR
' -----[ Initialization ]----------------------------------------------
DEBUG "Program Running!"
FREQOUT 4, 2000, 3000
start/reset.
' -----[ Main Routine ]------------------------------------------------
Main:
DO
GOSUB Roam
GOSUB Sniff
LOOP
Chapter 7: Navigating with Infrared Headlights · Page 267
Bit
Bit
Word
Word
Nib
' its position.
' Apply the pulse.
' 5 ms for detectors
' Check IR Detectors
' Left IR sensor reading
' Right IR sensor reading
' Pulses sent to servos
' Loop counter
' Signal program

Advertisement

Table of Contents
loading

Table of Contents