Issues Uploading to Arduino Uno/ NRF24L01

Hello,

I’m experiencing an issue with my NRF24L01 and Arduino Uno/ Arduino Nano Every setup.

I’m attempting to use an Arduino Nano Every (Transmitter) in combination with an NRF24L01 to communicate with my Arduino Uno and its respective NRF24L01.

When attempting to upload the following sketch to my Arduino uno I receive this error code:
“void value not ignored as it ought to be'', with the IDE highlighting this portion of the code insinuating an error, “done = radio.read(text, 1);”

#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>

RF24 radio(7, 8); // CE, CSN
const uint64_t address = 0xE8E8F0F0E1LL;
int text[1];
int DIR = 2;
int STEP = 3;

void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.startListening();

pinMode(DIR,OUTPUT);
pinMode(STEP,OUTPUT);

}

void loop()
{
data_receive ();
}

void motor_forward ()
{
digitalWrite(DIR, LOW);
digitalWrite(STEP, LOW);
digitalWrite(STEP, HIGH);
delayMicroseconds(50);
}

void motor_reverse ()
{
digitalWrite(DIR, HIGH);
digitalWrite(STEP, LOW);
digitalWrite(STEP, HIGH);
delayMicroseconds(50);
}

void data_receive ()
{ radio.startListening();
radio.stopListening();
radio.openReadingPipe(1, address);
radio.startListening();
bool done = false;
done = radio.read(text, 1);
Serial.println(done);
radio.read(text, 1);
// Serial.println(text[0]);
// right
if (text[0] == 10) {
motor_forward ();
Serial.println("right");
while (text[0] == 10) {
radio.read(text, 1);
motor_forward ();
}
}

// left
if (text[0] == 11) {
motor_reverse ();
// Serial.println("left");
while (text[0] == 11) {
radio.read(text, 1);
motor_reverse ();
}
}
}

Troubleshooting methods attempted:

Different Cables
Switching the computer on and off to remove an potential glitches
Ensuring I’ve selected the correct board and ports.

I am a total novice to this stuff so any insight would be helpful.

Your code is not in code tags, horribly formatted,
uses deprecated library functions, and is really insensible.

Start with something simpler first.

It’s for something I’m building. I had someone on Fiverr make this code for me. Again any assistance would help

Take it back to them and tell them to fix it.

Or, try replacing

bool done = false;
done = radio.read(text, 1);
Serial.println(done);

with

radio.read(text, 1);

Also, you have double posted. That is not allowed here.
https://forum.arduino.cc/t/issues-uploading-sketch-arduino-uno-nrf24l01/1021100

You also blew past the forum introduction and guides. Not a good idea.

Sorry for the double post. I got a system message saying my post was removed so I tried posting it again, I didn't realize it was a temporary thing.

Also, i tried the code modifications you suggested and it worked and uploaded to the board however when I check the serial monitor it still show nothing. Am I missing something obvious? Here's my schematic

The code tags, please.

You don't need two libraries for the same radio. Remove the first one.

RF24::read() doesn't return a value.

Look at the "GettingStarted" example that comes with the RF24 library to see how the library is supposed to be used.

Older versions of the rf24 library had the read function return a value. That is no longer the case.

From the RF24.h file (line 429).
@note This function no longer returns a boolean. Use available to
* determine if packets are available. The RX_DR Interrupt flag is now
* cleared with this function instead of when calling available().
* @code
* if(radio.available()) {
* radio.read(&data, sizeof(data));
* }

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.