StripeFollowingBoeBot

StripeFollowingBoeBot - ' FREQOUT 4, 2000, 3000 F ' -----[...

Info iconThis preview shows pages 1–2. Sign up to view the full content.

View Full Document Right Arrow Icon
' -----[ Title ]-------------------------------------------------------------- ' Robotics with the Boe-Bot - StripeFollowingBoeBot.bs2 ' Boe-Bot adjusts its position to move toward objects that are closer than ' zone 3 and away from objects further than zone 3. Useful for following a ' Useful for following a 2.25 inch wide vinyl electrical tape stripe. ' ' {$STAMP BS2} ' Stamp directive. ' {$PBASIC 2.5} ' PBASIC directive. ' ' -----[ Constants ]---------------------------------------------------------- ' Kpl CON 35 ' Change from -35 to 35 Kpr CON -35 ' Change from 35 to -35 SetPoint CON 3 ' Change from 2 to 3. CenterPulse CON 750 C ' -----[ Variables ]---------------------------------------------------------- ' freqSelect VAR Nib irFrequency VAR Word irDetectLeft VAR Bit irDetectRight VAR Bit distanceLeft VAR Nib distanceRight VAR Nib pulseLeft VAR Word pulseRight VAR Word p ' -----[ Initialization ]-----------------------------------------------------
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
Background image of page 2
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ' FREQOUT 4, 2000, 3000 F ' -----[ Main Routine ]-------------------------------------------------------' DO D GOSUB Get_Ir_Distances ' Calculate proportional output. pulseLeft = SetPoint - distanceLeft * Kpl + CenterPulse pulseRight = SetPoint - distanceRight * Kpr + CenterPulse GOSUB Send_Pulse LOOP L ' -----[ Subroutine - Get IR Distances ]--------------------------------------' Get_Ir_Distances: distanceLeft = 0 distanceRight = 0 FOR freqSelect = 0 TO 4 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 NEXT RETURN ' -----[ Subroutine - Get Pulse ]---------------------------------------------' Send_Pulse: PULSOUT 13,pulseLeft PULSOUT 12,pulseRight PAUSE 5 RETURN...
View Full Document

This note was uploaded on 04/23/2010 for the course EECC 0306-201 taught by Professor Roymelton during the Spring '10 term at RIT.

Page1 / 2

StripeFollowingBoeBot - ' FREQOUT 4, 2000, 3000 F ' -----[...

This preview shows document pages 1 - 2. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online