Shop OBEX P1 Docs P2 Docs Learn Events
SimpleIDE IR — Parallax Forums

SimpleIDE IR

NWCCTVNWCCTV Posts: 3,629
edited 2013-07-10 08:45 in Propeller 1
Does anyone have an example/test program for Simple IDE to use a remote control with a Parallax IR setup? My Wild Thumper will be here tomorrow and although I have written code to make it work using a light sensor, I would really like to start out using a remote control first. I have the SPIN objects but I kind of wanted to code it all using Simple IDE.

Comments

  • ratronicratronic Posts: 1,451
    edited 2013-07-09 14:03
    If you are looking for C language for IR I don't have it, but I do have some Spin code that uses a cog to run in the background all of the time looking for a button on a Sony TV remote being pressed.
  • jazzedjazzed Posts: 11,803
    edited 2013-07-09 14:36
    The Parallax doesn't have IR Simple Libraries and tutorials yet.

    If you have IR code written in PASM, you can include the .spin file in the SimpleIDE project and translate the interface functions from SPIN to C.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-07-09 15:18
    OK, Thanks guys. @ratronic, Is that the file that is in the OBEX? If so, I have it. I think I will try what jazzed recommends and see if I can get it working that way. Thanks again.
  • ratronicratronic Posts: 1,451
    edited 2013-07-09 15:26
    I think that is were I got it from. It is written by somebody else I just modified it to run all the time in the background in another cog. This zip contains an example that prints the current button being pressed to the serial terminal. It returns 255 if no button is being pressed.
    zip
    10K
    IR.zip 10.5K
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-07-09 17:05
    Ah. Not the same one I have. I will give this one a try. Thank you
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-07-09 19:32
    @ratronic, I tried that code but it is not working. So far the only IR code I can get to work properly is the Demo from Learn.parallax.com. I notice the pin declaration does not define which pin the IR receiver is on. Does it search for it on it's own or what?
  • ratronicratronic Posts: 1,451
    edited 2013-07-09 20:02
    NW the port pin for the IR receiver is declared as IRP in the Con section of atemp1.spin. Change it from 6 to whatever port# you have your receiver connected. Also the receiver is powered from 5V so you will want to use a 2.2k to 4.7k resistor between the Vout on the receiver and your port pin. I have this setup right now working on a PropBOE.. After you set IRP for the port your receiver is hooked to run atemp1 and make sure the serial terminal is set to 115200 baud. Let me know your results.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-07-09 20:11
    @ratronic, thanks. I will give that a shot. I already have the resistor in place. I will just change from pin 0 to pin 6 so I do not have to mess with the software. I was looking in the other objects for the pin number but must have missed that one. Thanks again.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-07-09 20:28
    OK. So I was able to get your code going. However, I have one question. The comment says that the serial terminal will display the number pressed. However, when I press 1 it shows 0, 2 shows 1 and so on. Is it suppose to be like this?
  • ratronicratronic Posts: 1,451
    edited 2013-07-09 20:36
    Actually Sony TV remotes sends out decimal # 0 - 8 for keys 1 - 9 and decimal # 9 for key 0. So that comment is a bit misleading.

    EDIT: Yes that is supposed to be like that - I have no clue why.
  • NWCCTVNWCCTV Posts: 3,629
    edited 2013-07-09 22:24
    So any ideas on how I could get this same program to work with SimpleIDE?
  • ratronicratronic Posts: 1,451
    edited 2013-07-10 08:45
    I don't use SimpleIDE for Spin but I fired up a version (0.9.28) I downloaded not long ago and was able to get atemp1.spin to run in SimpleIDE's serial terminal. Unchanged it takes a couple of seconds for the button you press to show up on it's serial terminal. If you change

    the waitcnt statement from a 100th of a second to a 10th of a second it will display better with SimpleIDE's serial terminal.
Sign In or Register to comment.