Program Help Please
BenO
Posts: 5
·this is where im stuck. can anyone help me? here is the program i am working on:
'
[noparse][[/noparse] Title ]
' Robotics with the Boe-Bot - RoamingWithIr.bs2
' Adapt RoamingWithWhiskers.bs2 for use with IR pairs
' {$STAMP BS2}······························ ' Stamp directive.
' {$PBASIC 2.5}····························· ' PBASIC directive.
DEBUG "Program Running!"
'
[noparse][[/noparse] Variables ]
· irDetectLeft· VAR···· Bit
· irDetectRight VAR···· Bit
· pusleCount··· VAR···· Byte
'
[noparse][[/noparse] Initialization ]
FREQOUT 4, 2000, 3000······················· ' Signal program start/reset
'
[noparse][[/noparse] Main Routine ]
DO
· FREQOUT 8, 1, 38500······················· ' Store IR detection values in
· irDetectLeft = IN9························ ' bit variables
· FREQOUT 2, 1, 38500
· irDetectRight = IN0
· IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
··· GOSUB Back_Up··························· ' Both IR pairs detect obstacle
··· GOSUB Turn_Left························· ' Back up and U-turn (left twice)
··· GOSUB Turn_Left
· ELSEIF· (irDetectLeft = 0) THEN··········· ' Left IR pair detects
··· GOSUB Back_Up··························· ' Back up & turn right
··· GOSUB Turn_Right
· ELSEIF (irDetectRight = 0) THEN··········· ' Right IR pair detects
··· GOSUB Back_Up··························· ' Back up & turn left
··· GOSUB Turn_Left
· ELSE······································ ' Both IR pairs 1, no detects
··· GOSUB Forward_Pulse····················· ' Apply a forward pulse
· ENDIF····································· ' and check again
LOOP
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:03:01 AM GMT
'
[noparse][[/noparse] Title ]
' Robotics with the Boe-Bot - RoamingWithIr.bs2
' Adapt RoamingWithWhiskers.bs2 for use with IR pairs
' {$STAMP BS2}······························ ' Stamp directive.
' {$PBASIC 2.5}····························· ' PBASIC directive.
DEBUG "Program Running!"
'
[noparse][[/noparse] Variables ]
· irDetectLeft· VAR···· Bit
· irDetectRight VAR···· Bit
· pusleCount··· VAR···· Byte
'
[noparse][[/noparse] Initialization ]
FREQOUT 4, 2000, 3000······················· ' Signal program start/reset
'
[noparse][[/noparse] Main Routine ]
DO
· FREQOUT 8, 1, 38500······················· ' Store IR detection values in
· irDetectLeft = IN9························ ' bit variables
· FREQOUT 2, 1, 38500
· irDetectRight = IN0
· IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
··· GOSUB Back_Up··························· ' Both IR pairs detect obstacle
··· GOSUB Turn_Left························· ' Back up and U-turn (left twice)
··· GOSUB Turn_Left
· ELSEIF· (irDetectLeft = 0) THEN··········· ' Left IR pair detects
··· GOSUB Back_Up··························· ' Back up & turn right
··· GOSUB Turn_Right
· ELSEIF (irDetectRight = 0) THEN··········· ' Right IR pair detects
··· GOSUB Back_Up··························· ' Back up & turn left
··· GOSUB Turn_Left
· ELSE······································ ' Both IR pairs 1, no detects
··· GOSUB Forward_Pulse····················· ' Apply a forward pulse
· ENDIF····································· ' and check again
LOOP
Post Edited By Moderator (Joshua Donelson (Parallax)) : 10/23/2009 4:03:01 AM GMT
Comments
·· As you are new to the forums you probably didn't realize it's hard to get help without putting a descriptive subject line in your message.· Also, people will be less likely to try·and help you·if they don't know what your problem is.· Please state your problem clearly in detail...What you're doing and what results you are getting.· Also edit your original post and add a subject line.· Help us help you.
▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
Chris Savage
Parallax Tech Support
csavage@parallax.com
Post Edited (Chris Savage (Parallax)) : 2/20/2006 3:48:13 AM GMT