Shop OBEX P1 Docs P2 Docs Learn Events
IR sensors Buging — Parallax Forums

IR sensors Buging

Green4LGreen4L Posts: 1
edited 2014-03-25 09:28 in Accessories
I have a school project which is based making a working Boe-bot (IR sensors) to navigate through a handmade city. I got little problem with my code so i need some help!
This code is simple.

' {$STAMP BS2}
' {$PBASIC 2.5}

DEBUG "Program Running!"
irDetectLeft VAR Bit
irDetectRight VAR Bit
pulseLeft VAR Word
pulseRight VAR Word
FREQOUT 4, 2000, 3000
DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0

IF (irDetectLeft = 0) AND (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 850
ELSEIF (irDetectLeft = 0) THEN
pulseLeft = 850
pulseRight = 850
ELSEIF (irDetectRight = 0) THEN
pulseLeft = 650
pulseRight = 650

ELSEIF (irDetectLeft = 0) THEN
pulseLeft = 750
pulseRight = 650

ELSEIF (irDetectRight = 0) THEN
pulseRight = 850
pulseLeft = 750

ELSE
pulseLeft = 850
pulseRight = 650
ENDIF
PULSOUT 13,pulseLeft
PULSOUT 12,pulseRight
PAUSE 15
LOOP

Comments

  • FranklinFranklin Posts: 4,747
    edited 2014-03-23 14:13
    attachment.php?attachmentid=78421&d=1297987572 Also it helps to explain just what the problem you are having is. Tell us what works and what does not.
  • ercoerco Posts: 20,255
    edited 2014-03-25 09:28
    Green4L: Welcome to the forums! You'll need to describe the exact problems you're having to get the best help here. Looks like standard Parallax code you have there, which is time-proven. Are you sure it's not a wiring or hardware problem?

    BTW, low batteries are the #1 problem with problem robots. Try new batteries first to eliminate that possibility.
Sign In or Register to comment.