Hi Guys
I am new to Arduino's but am keen to learn. I have a NRF24L01 RF module coupled with a 3.3v adaptor board plugged into a Uno and another for the receiver. Image below
My problem is that for some reason it is not printing "hello world" when it receives a signal from the transmitter, it actually prints a blank line and jumps down to print "blank". I know that is receiving a signal as it is printing "blank" which I think it should only do if it gets a signal. Does anyone know what is wrong with this Sketch. As a second point it seems pretty sporadic when it prints or receives a signal is this normal or is there something else that I could improve.
Receiver sketch
/*
- Arduino Wireless Communication Tutorial
- Example 1 - Receiver Code
- by Dejan Nedelkovski, www.HowToMechatronics.com
- Library: TMRh20/RF24, GitHub - nRF24/RF24: OSI Layer 2 driver for nRF24L01 on Arduino & Raspberry Pi/Linux Devices
*/
#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() {
if (radio.available()) {
char text[11] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
Serial.println("blank");
}
}
Transmitter Sketch
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
radio.begin();
radio.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[] = "1";
radio.write(&text, sizeof(text));
delay(10);
}
