How to setup 2 nrf24

Hey all,

I am using 2(possibly more) nRF24L01+ in my project, and I am confused about one thing.

Almost all the same code goes for all the nodes. How do I setup an easy way to way to write node specific code?

For example I have:

#define RADIO_NUMBER 0

And then:

  radio.openReadingPipe(1, addresses[1]);
    radio.openReadingPipe(1, addresses[0]);

How do I use the same method to decide which pipe to use for writing an AckPayload? I guess something like this?

radio.writeAckPayload(!RADIO_NUMBER, &foo, SIZE);

Please, any guidance is appreciated :slight_smile:

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

There is also a connection test program to check that the Arduino can talk to the nRF24 it is connected to.

A common problem with nRF24 modules is insufficient 3.3v current from the Arduino 3.3v pin. The high-power nRF24s (with the external antenna) will definitely need an external power supply. At least for testing try powering the nRF24 with a pair of AA alkaline cells (3v) with the battery GND connected to the Arduino GND.

The Tutorial includes an example for a master and 2 slaves that can easily be extended to a larger number of slaves.