Hello everyone,
So today I was trying to use an NRF24L01 to send data from an Arduino nano to Arduino mega I have checked my wiring many times and it is correct these are the codes that I used.
Receiver:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // 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() {
bool result = radio.isChipConnected ();
if (radio.available()) {
Serial.println (result);
char text[32] = "";
delay( 500);
radio.read(&text, sizeof(text));
Serial.println(text); //This will print out the received value
}
}
Transmitter:
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
RF24 radio(7, 8); // CE, CSN
int text = 1;
const byte address[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[32] = "Hello World";
radio.write(&text, sizeof(text));
Serial.println("Sending Data");
delay(1000);
}
all help is appreciated