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.
