Using NRF24L01 with Arduino ESPLORA

I started following this tutorial: but I'm having trouble with it.
I don't really know where I'm wrong.

I pasted the codes for the one-way example - and I obviously changed the pins in the code to follow my own connections on Arduino ESPLORA and Arduino UNO.
I'm also using this to convert Esplora's 5v into 3.3v (so I can power the NRF24L01 without any problem).
I checked multiple times my connections but I'm still stuck.
What can I do?

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#include <Esplora.h>

RF24 radio(1, 0); // CE, CSN

const byte address[6] = "00001";
void setup() {
void loop() {
  const char text[32] = "Hello";
  radio.write(&text, sizeof(5));

Also this code doesn’t turn off the Esplora RGB for 0.1s: the RGB remains always ON

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

A common problem with nRF24 modules is insufficient 3.3v current. Try powering them with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.


Thanks. Can I contact you for any further problem with this thread?

Ok I did solve this. The problem is that I can't put the dataReceived into another variable

char data = dataReceived

Also I would like to send more than one value in this (let's say that I want to send the speed of a car and the on/off of a led.
How can I send these informations?
Like sending just 140 1
Or also sending S140 L1
But I don't know how to let the RX understand these strings

What are the datatypes of the two values you want to send?

If they are both the same then you can put them into an array and send the array. If the datatypes are different you can create a struct and send that.

The important thing is to have the exact same array or struct on the receiving side.

The examples in my tutorial illustrate the sending of arrays.

You need to provide more information about what is the purpose behind

char data = dataReceived

Without knowing the datatypes it is hard to suggest a solution - and it may not be necessary. If you have a program in which you tried that please post the program.

Can I contact you for any further problem with this thread?

Just post your question in this Thread.


I'm going to send two Ints, but I'd really like to know also how to send floats and strings/char for future projects :slight_smile:

Also how do I move the sent variable to another variable and how do I compare that with something?

if(dataReceived == "ON") {
   digitalWrite(pin_led, HIGH);

I'm going to send two Ints, but I'd really like to know also how to send floats and strings/char for future projects :slight_smile:

For mixed datatypes use a struct, as I suggested in Reply #6. If all the items are the same type you can use an array if you find it easier.

Also how do I move the sent variable to another variable and how do I compare that with something?

You need to specify the datatypes. If you want to copy a cstring you should strcpy()

However if you just send 'N' for ON you can use == as in

if (dataReceived == 'N') {

however that assumes that the variable dataReceived is defined as char

As you can see your questions need to be more specific.


First: I don't really know structs in c++ I only know them in swift.

A more specific question as you asked for: how do I send 4 different Bool (in int so 0 1) in only one "message" separated by a space/other characters and turn on 4 different LEDs to get an output of the 4 Ints that I sent.
Please don't treat the 0 and 1 as bits but treat them as Ints, because I'd like to take your example code to use it to experiment as much as I can


By the way it's always a pleasure to talk with you :smiley: you're always so open and friendly and your explanations are way too good

I did it by following the tutorial that you linked me and also this one: to understand what is a struct.

The only problem that persists is that I don’t know how to send a string also using the struct (which allows me to send double, int, float, single chars…)

In fact if I use this code

// SimpleTx - the master or the transmitter

#include <SPI.h>
#include <RF24.h>
#include <Esplora.h>

#define CE_PIN 7 //9
#define CSN_PIN 8 //10

const byte slaveAddress[5] = {'R','x','A','A','A'};

RF24 radio(CE_PIN, CSN_PIN); // Create a Radio

int dataToSend[2]= {0, 1};

unsigned long currentMillis;
unsigned long prevMillis;
unsigned long txIntervalMillis = 1000; // send once per second

typedef struct {
  int x;
  float y;
  char z[3];
Tx duino1;

void setup() {


    Serial.println("SimpleTx Starting");

    radio.setDataRate( RF24_250KBPS );
    radio.setRetries(3,5); // delay, count


void loop() {
    duino1.x = Esplora.readSlider();
    duino1.y = 22.4576;
    duino1.z = "AB";


void send() {

    bool rslt;
    rslt = radio.write( &duino1, sizeof(duino1) );
        // Always use sizeof() as it gives the size as the number of bytes.
        // For example if dataToSend was an int sizeof() would correctly return 2

    Serial.print("Data Sent ");
  //  Serial.print(dataToSend);


It prints me out this error:

error: invalid array assignment
     duino1.z = "AB";

Slow down. I can’t keep up. Wait until you get a response to one Post before adding another. Or (perhaps better) don’t Post until you have done all your thinking.

You can’t assign text to an array like this

duino1.z = "AB";

As I said in Reply #9 you need to use strcpy()

May I suggest that you NEVER use single character variable names (except for the index in a FOR loop) because it is impossible to search a program to find all the instances of a single character variable name.


I posted a lot because the problems that I told in previous posts were solved by myself :wink:

How do I use strcpy()?
It only allows to copy strings(?)

How do I use strcpy()?

Have you studied the link I gave you in Reply #9?

It only allows to copy strings(?)


What else do you want to copy? (I can't guess what's in your head - my crystal ball is broken)


Okay I did it! Thanks Robin :smiley: