I've done a few projects using the NRF24L01 boards but today I can not get them to work, more than likely missing the obvious but would like you to check what I have been doing.
I use the attached code as a check to make sure the hardware I have is functional, I've used it before. I copied these off off the "Howtomechatronics" website. Other than a couple of Serial.print statements I have not modified them. They're a good basic setup, again just to prove it's working before incorporating it into my project. For my project I only need one way communications.
I have swapped out every component one at a time, including the dupont wires, to see if one of them is bad. I've tried powering them directly and using the the breakout adapters so I can use 5V, that is currently how I have them setup. I've tried both Uno's and Nanos.
Here are my connections
Uno/Nano ------------------- Breakout Board
5V ------------------------------- Vcc
GND ---------------------------- Gnd
Pin 7 ---------------------------- CE
Pin 8 ---------------------------- CSN
Pin 11 -------------------------- MOSI
Pin 12 -------------------------- MISO
Pin 13 -------------------------- SCK
I've also tried other programs. So I've replaced the programs and all hardware but still can't get them talking to each other. I may have multiple component failures.
So the questions are, should this code work? Do I have them connected properly?
Thanks
John
Transmitter code
/*
* Arduino Wireless Communication Tutorial
* Example 1 - Transmitter Code
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#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.openWritingPipe(address);
radio.setPALevel(RF24_PA_MIN);
radio.stopListening();
}
void loop() {
const char text[] = "Hello World";
radio.write(&text, sizeof(text));
//Serial.println(text);
delay(1000);
}
Receiver code
/*
* Arduino Wireless Communication Tutorial
* Example 1 - Receiver Code
*
* by Dejan Nedelkovski, www.HowToMechatronics.com
*
* Library: TMRh20/RF24, https://github.com/tmrh20/RF24/
*/
#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() {
//Serial.println("loop");
if (radio.available()) {
//Serial.print("available");
char text[32] = "";
radio.read(&text, sizeof(text));
Serial.println(text);
}
}




