The nRF24L01 module only sends data when I put something very close it, but if I don't put nothing close, it don't sends any data.
My trasnmitter code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 8); //CE, CSN
const byte rxAddr[6] = "00001";
void setup()
{
SPI.begin();
radio.begin();
Serial.begin(9600);
radio.setRetries(15, 15);
radio.stopListening();
radio.openWritingPipe(rxAddr);
delay(100);
}
void loop()
{
const char text[] = "Hello World";
radio.stopListening();
radio.write(&text, sizeof(text));
Serial.println("sending");
delay(1000);
}
My receiver code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(4, 3);
const byte rxAddr[6] = "00001";
void setup()
{
SPI.begin();
while (!Serial);
Serial.begin(115200);
radio.begin();
radio.openReadingPipe(0, rxAddr);
radio.startListening();
radio.flush_rx();
}
void loop()
{
if (radio.available())
{
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
}
}
I apologize my bad English, that's not my native language.
All replies are welcome