Shop OBEX P1 Docs P2 Docs Learn Events
Multiple Basic Stamp 2's and Basic Stamp 2sx's with same ir led/detector problem. — Parallax Forums

Multiple Basic Stamp 2's and Basic Stamp 2sx's with same ir led/detector problem.

aaz707aaz707 Posts: 8
edited 2012-06-12 20:33 in BASIC Stamp
Hi

I am making a program involving ir leds and 38.5khz ir detector. I wrote the program and everything is working great, then all of the sudden my ir detector seems to of stopped working ( always showing a high on what ever pin I connect it to). So I figure maybe the wiring-double checked-triple checked its not the wiring. Second I think it might be my program so I run the program from Stamp Works page 120 about the ir led and detector here is the code:

' {$STAMP BS2}
' {$PBASIC 2.5}
'
[ Program Description ]
'
' This program uses FREQOUT without a filter to modulate an IR LED for
' detection by a demodulating receiver.
'
[ I/O Definitions ]
IrLed PIN 0 ' IR LED output
IrDectect PIN 1 ' detector input
'
[ Constants ]
IrMod CON 38500 ' 38.5 kHz (harmonic)
ModTime CON 1 ' 1 ms
NoDetect CON 1 ' detector is active-low
'
[ Variables ]
object VAR Bit
'
[ Program Code ]
Main:
DO
GOSUB Scan_IR
IF (object = NoDetect) THEN
DEBUG HOME, "All clear", CLREOL
ELSE
DEBUG HOME, "Intruder Alert!", CLREOL
ENDIF
PAUSE 100
LOOP
'
[ Subroutines ]
Scan_IR:
FREQOUT IrLed, ModTime, IrMod ' module IR LED
object = IrDectect ' scan detector
RETURN

I input this code onto my stamp to see if the possible problem could have been with my original program. Ir detector still doesn't work.
So i have a couple other stamps laying around I fig ill try those. First one I try is a stamp BOE, run the program that I pasted above all it says is intruder alert. Second stamp I try is my first Basic Stamp 2sx run the program sure enough "intruder alert". Im starting to think this is a hardware problem. So I try my OEM basic stamp 2 run the program and again same as before. Last but not least I try my last basic stamp which is another Basic Stamp 2sx run the program and everything works perfect a message comes up in debug saying "All Clear" and when I pass my hand in the path of the detector and led debug displays "Intruder Alert". So that being said I know its not a wiring issue or software issue. My question is what could be causing this problem to occur in not 1 but 3 of my stamps. Please help

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2012-06-12 20:33
    There is a difference between the BS2 and BS2sx FREQOUT statements. The BS2 and BS2sx use different frequency and duration units and the $STAMP directive would have to be changed as well to successfully compile and download the program to your BS2sx modules. You didn't say whether you changed the values in the FREQOUT statement for the Stamp model.

    There is no other reason why the program might work on only one of your Stamps and this reason still doesn't explain why it might work on one BS2sx and not the other. The most likely explanation is that in moving things around from Stamp to Stamp, you didn't really wire them identically and something was wrong with the wiring. You may have a breadboard with some kind of intermittent connection. There is no obvious answer as to why it only works on one out of four Stamps and you haven't provided really enough information to tell why ... and are not likely to be able to do so.
Sign In or Register to comment.