Shop OBEX P1 Docs P2 Docs Learn Events
infared programs — Parallax Forums

infared programs

adam4adam4 Posts: 10
edited 2007-01-03 21:10 in BASIC Stamp
is there some thing in my program that makes the left sensor work and the right one not work in the program other than my ports.

' Robotics with the Boe-Bot - TestIrPairsAndIndicators.BS2
' Test IR object detection circuits.
' {$STAMP BS2} ' Stamp directive.
' {$PBASIC 2.5} ' PBASIC directive.
'
Variables
irDetectLeft VAR Bit
irDetectRight VAR Bit
'
Initialization
DEBUG "Testing piezospeaker..."
FREQOUT 4, 2000, 3000
DEBUG CLS,
"IR DETECTORS", CR,
"Left Right", CR,
"

"
'
Main Routine
DO
FREQOUT 8, 1, 38500
irDetectLeft = IN9
FREQOUT 2, 1, 38500
irDetectRight = IN0
IF (irDetectLeft = 0) THEN
HIGH 10
ELSE
LOW 10
ENDIF
IF (irDetectRight = 0) THEN
HIGH 1
ELSE
LOW 1
ENDIF
DEBUG CRSRXY, 2, 3, BIN1 irDetectLeft,
CRSRXY, 9, 3, BIN1 irDetectRight
PAUSE 10
LOOP

______
P.S
i am a beginer please respond in english. and freqout controles the speakers right???

Comments

  • adam4adam4 Posts: 10
    edited 2007-01-03 18:51
    i sent it twice by accedent
    sorry
  • UnsoundcodeUnsoundcode Posts: 1,532
    edited 2007-01-03 19:42
    Looks like it should work, are you holding pins 9 and 0 high with a resistor?

    Jeff T.
  • edited 2007-01-03 21:10
    I will remove the other instance of this thread. Here is the post I made there before seeing this one:

    Both of my Boe-Bot's IR detectors are working with your program. There's probably a wiring error.

    Make sure to unplug power between every wiring adjustment.

    Double and triple check your wiring. Also, look where the LED cathodes and anodes are supposed to be plugged in. If the LED is in backwards, it won't let current through, which means it won't emit IR light. The wiring diagram points out the cathodes. Cathodes and anodes are explained on page 46-47 of Robotics with the Boe-Bot.

    You can test for damaged components by swapping the left and right parts. Start with the receivers. If the right side still doesn't work, swap IR LEDs, making sure to follow the schematic and wiring diagrams so that the IR LED anodes and cathodes are plugged into the correct sockets.

    The FREQOUT command in the initialization section controls the speakers. The other FREQOUT commands cause the IR LEDs to emit light that flashes on/off at a rate that will be detected by the IR receivers.

    This program came from Robotics with the Boe-Bot. Go through the book sequentially with one exception; save chapter 6 for the end. By taking it one activity at a time, it'll really help build your Electronics/Robotics skills.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Andy Lindsay

    Education Department
    Parallax, Inc.
Sign In or Register to comment.