RF Module sample program
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);
··············· }
··········· }
········· }
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
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
Thank you for your reply.
I have been away and just saw it.
Issy