I recently decided to try a simple sketch for the NRF24L01. Every time I upload the sketches to the two Arduinos I have, weird characters and text pops up in the Serial Monitor. I've tried absolutely everything and ensured that the hardware is hooked up correctly thousands of times. Every time, a bunch of random data and question marks pop up in the Serial Monitor. Tears have been shed over this. Please Help. Anybody.
Here's the code
Transmitter Code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio( 7, 8 ); // CE, CSN
const byte address[6] = "96276";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MAX);
radio.stopListening();
}
void loop() {
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
}
Reciever Code:
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio( 7, 8 ); // CE, CSN
const byte address[6] = "96276";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(address);
radio.setPALevel(RF24_PA_MAX);
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
delay(1000);
}
}