Hello, I know this is a common question on the forum but I do not know what is going wrong. I have one transmitter and one receiver. All, I believe, are connected correctly. However, there is no blinking on the transceivers, I don't know if this is supposed to happen or not because I year ago I did the same project and I have a faint remembrance that they blinked.
Here is the code:
transmitter:
//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(9, 8); // CE, CSN
//address through which two modules communicate.
const byte address[6] = "00001";
void setup()
{
Serial.begin(9600);
radio.begin();
//set the address
radio.openWritingPipe(address);
radio.setPALevel (RF24_PA_MIN);
//Set module as transmitter
radio.stopListening();
}
void loop()
{
//Send message to receiver
const char text[] = "Hello World";
//Check Section
Serial.print("hello2 ");
Serial.print(" -");
//Sends the information to the Receiver
radio.write(&text, sizeof(text));
//Checks what was sent to the reciever
int check = radio.write(&text, sizeof(text));
Serial.print(check);
Serial.print("- ");
Serial.print("hello ");
if (!check){
Serial.println("Not working 2");
}
delay(1000);
}
Receiver:
`//Include Libraries
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
//create an RF24 object
RF24 radio(9, 8); // CE, CSN
//address through which two modules communicate.
const byte address[6] = "00001";
void setup()
{
while (!Serial);
Serial.begin(9600);
radio.begin();
//set the address
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
//Set module as receiver
//radio.startListening(); // this is moved to the void loop() section
}
void loop()
{
radio.startListening();
//Read the data if available in buffer
if (radio.available())
{
char text[32] = {0};
radio.read(&text, sizeof(text));
Serial.println(text);
}
else{
Serial.println("Not working 1");
delay(1000);
}
delay(1000);
}