NRF24L01 wireless!!

I have made a transmitter code below for nrf24l01 but I dont know how to set channel…My project contain 3 pairs of nrf and I want to set different channels please could you help me?


#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
#define CE_PIN 9
#define CSN_PIN 10
#define JOYSTICK_X A7

const uint64_t pipe = 0xE8E8F0F0E1LL;

RF24 radio(CE_PIN, CSN_PIN);
int joystick[1];

void setup()

void loop()
joystick[0] = analogRead(JOYSTICK_X);
radio.write( joystick, sizeof(joystick) );

The function in RF24 library is setChannel(). From RF24.h

/** * Set RF communication channel * * @param channel Which RF channel to communicate on, 0-127 */ void setChannel(uint8_t channel);

Thanks for your reply. How I could see what factions has the library?

All of the functions of a library are declared in the .h file(s). The ,cpp file(s) hold the definitions (the actual function code). The library reference can be found here RF24 reference

Why the nrf has different addresses? What is the utility of them?

If I want channel 0 foe example I would write void setChannel(unit8_t10)?

Channel 10*

To set to channel 0


Using, of course, your name for the radio instance.

This faction set before void setup function? Also what do you mean name for the radio?

Yoy would normally set the channel in the setup() function. The name of the instance is the name you give the instance of the RF24 object when constructed.

RF24 radio(9,10);

constructs an instance of a RF24 object called radio using pins 9 and 10 for the chip select and chip enable.