Hi all,
I wrote a nRF Serial Chat to the RF24 example...
If you have nothing to do, you can load this up to two UNO/PCs and wireless/RF chat with yourself..
If the radios are far away, you might even know which bytes are dropped... good exercise running back and forth..
Can you be modified to take in Serial input (GPS,etc) and send it across using the nRF to the other side..
Github repo :-
https://github.com/stanleyseow/RF24/blob/master/examples/nRF24_Serial_Chat/nRF24_Serial_Chat.ino
Source code :-
/*
nRF Serial Chat
Date : 22 Aug 2013
Author : Stanley Seow
e-mail : stanleyseow@gmail.com
Version : 0.90
Desc :
I worte this simple interactive serial chat over nRF that can be used for both sender
and receiver as I swapped the TX & RX addr during read/write operation.
It read input from Serial Monitor and display the output to the other side
Serial Monitor or 16x2 LCD (if available)... like a simple chat program.
Max payload is 32 bytes for radio but the serialEvent will chopped the entire buffer
for next payload to be sent out sequentially.
*/
#include <LiquidCrystal.h>
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
LiquidCrystal lcd(10, 7, 3, 4, 5, 6);
RF24 radio(8,9);
const uint64_t pipes[2] = { 0xDEDEDEDEE7LL, 0xDEDEDEDEE9LL };
boolean stringComplete = false;Â // whether the string is complete
static int dataBufferIndex = 0;
boolean stringOverflow = false;
char charOverflow = 0;
char SendPayload[31] = "";
char RecvPayload[31] = "";
char serialBuffer[31] = "";
void setup(void) {
 Serial.begin(57600);
 lcd.begin(16,2);
 lcd.clear();
 lcd.setCursor(0,0);
 lcd.print("RF Chat V0.90");
 printf_begin();
 radio.begin();
Â
 radio.setDataRate(RF24_250KBPS);
 radio.setPALevel(RF24_PA_MAX);
 radio.setChannel(70);
Â
 radio.enableDynamicPayloads();
 radio.setRetries(15,15);
 radio.setCRCLength(RF24_CRC_16);
 radio.openWritingPipe(pipes[0]);
 radio.openReadingPipe(1,pipes[1]);Â
Â
 radio.startListening();
 radio.printDetails();
 Serial.println();
 Serial.println("RF Chat V0.90"); Â
 delay(500);
 lcd.clear();
}
void loop(void) {
Â
 nRF_receive();
 serial_receive();
Â
} // end loop()
void serialEvent() {
 while (Serial.available() > 0 ) {
   char incomingByte = Serial.read();
  Â
   if (stringOverflow) {
    serialBuffer[dataBufferIndex++] = charOverflow; // Place saved overflow byte into buffer
    serialBuffer[dataBufferIndex++] = incomingByte; // saved next byte into next buffer
    stringOverflow = false;             // turn overflow flag off
   } else if (dataBufferIndex > 31) {
    stringComplete = true;    // Send this buffer out to radio
    stringOverflow = true;    // trigger the overflow flag
    charOverflow = incomingByte; // Saved the overflow byte for next loop
    dataBufferIndex = 0;     // reset the bufferindex
    break;
   }
   else if(incomingByte=='\n'){
     serialBuffer[dataBufferIndex] = 0;
     stringComplete = true;
   } else {
     serialBuffer[dataBufferIndex++] = incomingByte;
     serialBuffer[dataBufferIndex] = 0;
   }    Â
 } // end while()
} // end serialEvent()
void nRF_receive(void) {
 int len = 0;
 if ( radio.available() ) {
   bool done = false;
   while ( !done ) {
    len = radio.getDynamicPayloadSize();
    done = radio.read(&RecvPayload,len);
    delay(5);
   }
Â
  RecvPayload[len] = 0; // null terminate string
 Â
  lcd.setCursor(0,0);
  lcd.print("R:");
  Serial.print("R:");
  lcd.setCursor(2,0);
  lcd.print(RecvPayload);
  Serial.print(RecvPayload);
  Serial.println();
  RecvPayload[0] = 0; // Clear the buffers
 }Â
} // end nRF_receive()
void serial_receive(void){
Â
 if (stringComplete) {
    strcat(SendPayload,serialBuffer);  Â
    // swap TX & Rx addr for writing
    radio.openWritingPipe(pipes[1]);
    radio.openReadingPipe(0,pipes[0]);Â
    radio.stopListening();
    bool ok = radio.write(&SendPayload,strlen(SendPayload));
   Â
    lcd.setCursor(0,1);
    lcd.print("S:");
    Serial.print("S:");
    lcd.setCursor(2,1);
    lcd.print(SendPayload);
    Serial.print(SendPayload);    Â
    Serial.println();
    stringComplete = false;
    // restore TX & Rx addr for reading  Â
    radio.openWritingPipe(pipes[0]);
    radio.openReadingPipe(1,pipes[1]);
    radio.startListening();Â
    SendPayload[0] = 0;
    dataBufferIndex = 0;
 } // endif
} // end serial_receive()