infared programs
adam4
Posts: 10
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???
' 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
sorry
Jeff T.
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.