Hello , I am trying to create a one way controller for a project and the (nRF24L01+PA+LNA) wireless modules will not connect to each other and I have tried all the suggestions I could find but nothing will even give me a sign of connection. Here is the code that I am using.
This is the Controller (Transmitter) Code. It is run by and Arduino Uno R3
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(9, 10); // CE, CSN
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[] = "1111";
radio.write(&text, sizeof(text));
Serial.println(text);
delay(1000);
}
This is the Reciever code. It is run by an Arduino Mega2560.
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(49, 48); // CE, CSN
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();
digitalWrite(22, HIGH);
delay(50);
digitalWrite(22, LOW);
delay(50);
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
if(text=="1111"){
Serial.println("Done");
digitalWrite(22, HIGH);
}
else{
digitalWrite(22, LOW);
}
}
}
Thank you very much. If you have any suggestions please let me know. I very much admire your knowledge of coding and electronics and I strive to be an engineer one day.