Sending string GPS data with nRF24L01

Haii, can someone help me
i’m beginner from this, i had project with GPS need to send GPS data using nRF24L01, but the receiver not showed the data… thank you

#include <SoftwareSerial.h>
#define DEBUG true
#define rfTransmitPin 4 
SoftwareSerial mySerial(2, 3);
#include <math.h>
#include <stdlib.h>
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

String latlng;
RF24 radio(7,8); // CE, SNE
const byte address[6] = "00001";

void getgps(void) {
  sendData( "AT+CGNSPWR=1", 1000, DEBUG);
  sendData( "AT+CGPSINF=0", 1000, DEBUG);

void sendData(String command, const int timeout, boolean debug) {
  String response = "";
  if (debug) {
    long int time = millis();
    while ( (time + timeout) > millis()) {
      while (mySerial.available()) {
        response += char(;
    latlng = "";
    if (response[19]!=NULL)
      for (int i = 46; i <= 65; i++)
        latlng = latlng + response [i];
      delay (300);

void setup() {
  Serial.println ("Tugas Akhir Ria Juliani Dewi");

void loop() {
    sendData( "AT+CGNSINF", 1000, DEBUG);
  Serial.print("Latlng: ");
  char datasend[25];
  sprintf(datasend,"%c%c:%c%c", latlng.c_str());

  //kirim data
  radio.write (&latlng, sizeof(latlng));
  Serial.print("data sent : ");
  Serial.println (latlng);
delay (3000);

Have a look at this Simple nRF24L01+ Tutorial.

Wireless problems can be very difficult to debug so get the wireless part working on its own before you start adding any other features.

The examples are as simple as I could make them and they have worked for other Forum members. If you get stuck it will be easier to help with code that I am familiar with. Start by getting the first example to work


      for (int i = 46; i <= 65; i++)
        latlng = latlng + response [i];

You don’t KNOW that the response has 65 characters. It is a VERY bad idea to assume that the latitude and longitude data will be in precisely those columns.

    long int time = millis();

Does time flow backwards in your universe? In mine, time is always stored in unsigned variables.

You only call this function in setup(), so it is EXTREMELY unlikely that the GPS is returning valid information microseconds after being powered up.

  radio.write (&latlng, sizeof(latlng));

You are seriously abusing this function. It is NOT designed to send Strings. It CAN send strings, but that is NOT what you have.

And, you failed to post the receiver code, or ANY serial output that proves that you are sending anything other than garbage.