Code: Select all
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
void begin(int8_t sck =12, int8_t miso =13, int8_t mosi =11, int8_t ss =10);
RF24 radio(10, 19); // CE, CSN
const byte address[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
delay(1000);
And this is the code for the receiver (esp32 c3) :
Code: Select all
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
void begin(int8_t sck =4, int8_t miso =5, int8_t mosi =6, int8_t ss =7);
RF24 radio(7, 3); // CE, CSN
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
}