Shop OBEX P1 Docs P2 Docs Learn Events
RF Module sample program — Parallax Forums

RF Module sample program

Istha PowronIstha Powron Posts: 74
edited 2006-09-29 14:14 in General Discussion
Hello,

I have just received my Javelin kit.

I typed in and tried to run the sample program for the 27980 rf module and it would not run. The error I received was;

RFmoduleTXX.java(5): Syntax:Unexpected symbol ignored


Any ideas?

here is the code;

·/***
····· test Transmit program for rf module
····· ***/
····· import stamp.core*;
····· public class RFmoduleTXX
······· {
······· static uart txUart = new Uart (Uart.dirTransmit, CPU.pin8, Uart.invert,
······································ Uart.speed9600, Uart.stopl);
······· static byte x = 0;
······· static byte y = 0;
······· public static void main()
········· {
········· while (true)
··············· {
··············· if (x >= 10) x = 0;
··············· else x++;
··············· if (y >= 10) y = 0;
··············· else y++;
··············· CPU.pulseOut(300, CPU.pn8);
··············· txUart.sendString("!");
··············· txUart.sendByte(x);
··············· txUart.sendByte(y);
··············· CPU.delay(25);
··············· }
··········· }
········· }

Comments

  • Peter VerkaikPeter Verkaik Posts: 3,956
    edited 2006-08-23 16:32
    You can't use pulseOut on pin8 if you have the uart running on pin8.
    Try this:
    /***
    ····· test Transmit program for rf module
    ····· ***/
    ····· import stamp.core*;
    ····· public class RFmoduleTXX
    ······· {
    ······· static uart txUart = new Uart (Uart.dirTransmit, CPU.pin8, Uart.invert,
    ······································ Uart.speed9600, Uart.stopl);
    ······· static byte x = 0;
    ······· static byte y = 0;
    ······· public static void main()
    ········· {
    ········· txUart.stop(); //stop uart
    ··········CPU.writePin(CPU.pin8,false); //make pin8 low output
    ········· while (true)
    ··············· {
    ··············· if (x >= 10) x = 0;
    ··············· else x++;
    ··············· if (y >= 10) y = 0;
    ··············· else y++;
    ··············· CPU.pulseOut(300, CPU.pin8); //send high pulse to synchronize rf transmitter
    ··············· txUart.start(); //start uart, in invert mode idle level is low (just as idle level pulseOut)
    ··············· //optional:·CPU.delay(105); //delay 10msec
    ·············· txUart.sendString("!");
    ··············· txUart.sendByte(x);
    ··············· txUart.sendByte(y);
    ··············· //CPU.delay(25);
    ··············· while·(!txUart.sendBufferEmpty()) ; //wait until all bytes transmitted
    ················txUart.stop(); //stop uart
    ··············· }
    ··········· }
    ········· }

    regards peter
  • Istha PowronIstha Powron Posts: 74
    edited 2006-09-29 14:14
    Peter,



    Thank you for your reply.

    I have been away and just saw it.

    Issy
Sign In or Register to comment.