Shop OBEX P1 Docs P2 Docs Learn Events
IR/Universal Remote — Parallax Forums

IR/Universal Remote

RsadeikaRsadeika Posts: 3,837
edited 2005-07-15 14:35 in BASIC Stamp
I think that I am getting some bad data from the following program. I am trying to figure out·if it is the programs fault or their is a bad Parallax IR detector. The following is a slightly modified program:

' {$STAMP BS2}
' {$PBASIC 2.5}
·IrDet PIN 9
·remoteCode VAR Byte
·IrPulse VAR Word

·Main1:
·· GOSUB GetCode
·· IF (remoteCode > 0) THEN GOSUB ProcessCode
·GOTO Main1

END

·ProcessCode:
·· DEBUG CLS, DEC remoteCode
·RETURN

·GetCode:
· remoteCode = 0
·· DO
··· RCTIME 9, 1, irPulse
·· LOOP UNTIL irPulse > 1000
·· PULSIN 9, 0, irPulse
·· IF irPulse > 500 THEN remoteCode.BIT0 = 1
·· RCTIME 9, 0, irPulse
·· IF irPulse > 300 THEN remoteCode.BIT1 = 1
·· RCTIME 9, 0, irPulse
·· IF irPulse > 300 THEN remoteCode.BIT2 = 1
·· RCTIME 9, 0, irPulse
·· IF irPulse > 300 THEN remoteCode.BIT3 = 1
·· RCTIME 9, 0, irPulse
·· IF irPulse > 300 THEN remoteCode.BIT4 = 1
·· RCTIME 9, 0, irPulse
·· IF irPulse > 300 THEN remoteCode.BIT5 = 1
·· RCTIME 9, 0, irPulse
·· IF irPulse > 300 THEN remoteCode.BIT6 = 1
·· IF (remoteCode < 10) THEN remoteCode = remoteCode + 1
·· IF (remoteCode = 10) THEN remoteCode = 0

·RETURN

The wiring is setup from the example in the Inrared Remote AppKit (#29122) docs.

The problem is when I press the ChUp button I am expecting 16, I am getting something like 63 or 127 depending on how long I hold the button down. The other buttons, when pressed, show non-expectant numbers. Do I have a bad or fried detector, or what.

Thanks

Comments

  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-14 15:24
    The problem may be with your code.· It takes a lot of work (under the hood) to manipulate individual bits in a variable, and the BS2 is the slowest of our BASIC Stamp 2-family·modules.· This article may help:

    ··· http://www.parallax.com/dl/docs/cols/nv/vol3/col/nv76.pdf

    And one of our staff engineers, Andy Lindsay, has written an excellent book on IR projects with the Boe-Bot:

    ··· http://www.parallax.com/detail.asp?product_id=28139

    The book may be helpful because the standard processor for the Boe-Bot is the stock BS2.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-07-14 15:55
    Jon,

    The program is a slightly modified IrRemoteCodeCapture.bs2 program that is listed in the Infrared Remote AppKit (#29122) documentation. I guess maybe my question is, how do·I know if I fried an IR detector. The IR detector is a three legged Parallax brand.

    Thanks
  • Jon WilliamsJon Williams Posts: 6,491
    edited 2005-07-14 16:04
    You can test it with the Stamp -- modulate an IR LED (use FREQOUT) for a couple milliseconds, then immediately look at the output from the IR detector (basically you're going to use the object detection code from our standard Boe-Bot projects).

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Jon Williams
    Applications Engineer, Parallax
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-07-14 20:36
    Update:

    The program works as expected, the IR detector is fine, the problem is with the remote. I remember when Sony used to make some good products. I can't believe that only after a year my 3 function Universal Remote has gone bad, it's not like the thing was used everyday.
  • NewzedNewzed Posts: 2,503
    edited 2005-07-14 20:39
    Maybe it just needs a new battery.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • Philip GamblinPhilip Gamblin Posts: 202
    edited 2005-07-15 04:41
    maybe it lost its programming?
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-07-15 12:14
    The batteries are fine. The Universal Remote is still putting out some codes, not the right ones. I could live with a specific number for a button that I press, the problem is that different buttons have the same number. As for the programming aspect, yes I tried to reprogram it.
  • NewzedNewzed Posts: 2,503
    edited 2005-07-15 12:18
    I don't know which remote you are using but I would suggest the Sony
    RM-V301.· This is an excellent remote, and I do not remember any of the buttons having the same number.· This is the remote I used with my train, and I am presently using it on my BoeBot.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    Sid Weaver
    Do you have a Stamp Tester yet?
    http://hometown.aol.com/newzed/index.html

    ·
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-07-15 12:45
    Sid,

    I am using the 3 Function Universal Remote that I purchased through Parallax. For some reason I thought that it was a Sony. Thanks for the tip, but for what I am going to be using it for, I need a cheap unit.

    Maybe I should start a new thread in the sandbox as to what to expect if I open the unit for inspection.
  • NewzedNewzed Posts: 2,503
    edited 2005-07-15 13:08
    I have one of those also, and it works equally well.· I think the RM-301 has a few more buttons which gave me some extra commands.

    Sid
  • allanlane5allanlane5 Posts: 3,815
    edited 2005-07-15 14:01
    You DID set the Universal Remote for a Sony code, right?
  • RsadeikaRsadeika Posts: 3,837
    edited 2005-07-15 14:35
    OPERATOR ERROR.

    This is very embarrasing, when you read the instructions correctly then things seem to work as advertised. It was that pesky little wait till the LED stays solid red, then enter the code, that was my problem.

    Thanks everybody
Sign In or Register to comment.