Good day, everyone! I hope you are doing well. I'm working on a project that includes two devices: one with an Arduino and the other with a wireless type nrf24l01. I want to use the transmitter to send text data and the receiving device to receive it. The connection and code are both correct, however the problem is that data is not being sent or received. I tried every answer I could find on the Internet as well as the ones I already knew, but to no avail. I replaced the wires and the problem persisted; I also changed the power supply and placed it externally, but the problem persisted. Thank you for your help
Sorry, but your description of your project makes no sense. Can you please show a block diagram of what you have and how the connect together?
@ppprat, your topic has been moved to a more suitable location on the forum. Installation and Troubleshooting is not for problems with (nor for advise on) your project.
I have the send code
#include <SPI.h>
#include "RF24.h"
RF24 myRadio (7, 8);
byte addresses[][6] = {"0"};
struct package {
char text[300] = "test is :";
};
typedef struct package Package;
Package data;
void setup() {
Serial.begin(57600);
delay(1000);
myRadio.begin();
myRadio.setAutoAck(false);
myRadio.setChannel(110);
myRadio.setPALevel(RF24_PA_MAX);
myRadio.setDataRate( RF24_250KBPS );
myRadio.openWritingPipe(addresses[0]);
myRadio.stopListening();
}
void loop() {
myRadio.write(&data, sizeof(data));
Serial.print("\nPackage:");
Serial.println(data.text);
delay(100);
}
And I have the following reception code
#include <SPI.h>
#include "RF24.h"
RF24 myRadio (7, 8);
byte addresses[][6] = {"0"};
struct package {
char text[300] ="test";
};
typedef struct package Package;
Package data;
void setup() {
Serial.begin(57600);
delay(1000);
myRadio.begin();
myRadio.setAutoAck(false);
myRadio.setChannel(110);
myRadio.setPALevel(RF24_PA_MAX);
myRadio.setDataRate( RF24_250KBPS );
myRadio.openReadingPipe(1, addresses[0]);
myRadio.startListening();
}
void loop() {
if ( myRadio.available()) {
while (myRadio.available()){
myRadio.read( &data, sizeof(data) );
}
Serial.println(data.text);
}
}
According to the diagram below, I connected the wireless with the Arduino:
wireless Arduino
SCK 13
MISO 12
MOSI 11
CE 7
CSN 8
VCC 5V Because I use an adapter with it
GND GND
The problem is that it never receives data from the transmitter.
Modify :
I checked the wireless through the example in the library using the name scanner, and it works and has no errors!!
Thanks, I hope someone finds some solutions for me
Looks like you are attempting to power the NRF devices from the Arduinos. Rarely, if ever, works. Try two AA cells in series for each NRF device. Worked for me without problems.
This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.