Shop OBEX P1 Docs P2 Docs Learn Events
RF Transmitter & Receiver - Newbie — Parallax Forums

RF Transmitter & Receiver - Newbie

stuartXstuartX Posts: 88
edited 2008-01-20 16:56 in BASIC Stamp
Hi all, I hope that i'm not wasting you alls valued time. I'm trying to learn about the RF Xmitter & Receiver.
what I would like to do is to trigger a device on connected to the RF receiver (RF receiver & stamp#1) by way of pressing a button on the Xmit side (with RF & stamp#2). In other words, i have two basic stamps separate from each other. On one stamp i have the RF Xmitter, and the other stamp i have the RF Xmitter. I would like to press a button on the RF Xmitter and have the RF Receiver receive the signal and turn on a led. Any help would be appreciated. Thanks in advance.

Comments

  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-19 21:34
    Have you looked at the coding examples that are included with the documentation on the RF receiver and transmitter?

    These transmit a 4 byte value from one Stamp to the other via the RF transmitter and receiver. You could transmit a single byte from one to the other and use a value of zero for off and one for on. The receiving Stamp simply copies the value to an I/O pin set to output mode, then goes back to wait for another message. The same sort of thing goes on at the transmit end. You can use the BUTTON statement if you want. When the state of the button changes, you send the new state as a byte value (with the "sync" character as shown in the examples).
  • stuartXstuartX Posts: 88
    edited 2008-01-19 22:00
    Yes, I did view and implement the example in the pdf. Honesty, i don't clearly understand all of it. I understand your advice, I just have to learn the correct syntax in the programming code. I will try and figure that out. Thank you for your expert advice.
  • Mike GreenMike Green Posts: 23,101
    edited 2008-01-19 22:15
    Look at the sections of the PBasic manual for SERIN / SEROUT / BUTTON / OUTPUT and the section on memory usage that describes how to reference individual I/O pins as variables (around page 100).
  • stuartXstuartX Posts: 88
    edited 2008-01-19 22:45
    Before I read your last post I tried a few things (see below):

    STAMP #1 (RF Xmit):

    x VAR Byte

    DO
    PULSOUT 8, 1200 'Sync pulse for the receiver
    SEROUT 8, 16468, [noparse][[/noparse]DEC 0011 ]

    PAUSE 5


    STAMP#2 (RF TX):

    x VAR BYTE

    DO
    LOW 0
    SERIN 7, 16468, [noparse][[/noparse]DEC x]
    HIGH 0
    DEBUG ? x

    LOOP

    I thought that I would see the same value (0011) on the RX debug but I saw the following:
    x = 8
    x = 8
    x = 8
    x = 8
    x = 8
    x = 8
    x = 8
    x = 8
    x = 8
    x = 0
    x = 0
    x = 0
    x = 8
    x = 8
    x = 8
    x = 0
    x = 0
    x = 8
    x = 0
    x = 8
    x = 0
    x = 8
    x = 8
    x = 4
  • FranklinFranklin Posts: 4,747
    edited 2008-01-20 04:30
    Since the transmitter does not know when the receiver is ready and the receiver is not waiting for input from the transmitter you will get times when the tx/rx are in sync (the 8s) and times when they are not. (the other stuff) Try putting a wait in the receive and a character to wait for in the tx. serout "!", [noparse][[/noparse]dec 8] serin wait "!" [noparse][[/noparse]dec x] (syntax is not correct you will have to look it up but the idea is there.

    ▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔▔
    - Stephen
  • stuartXstuartX Posts: 88
    edited 2008-01-20 16:56
    Thanks for the good advice & explanation. I will give it a shot.
Sign In or Register to comment.