void value not ignored as it ought to be

I am facing this problem in nRF24L01 receiver

#include <SPI.h>
#include “RF24.h”
#include “printf.h”
#include “RF24_config.h”
#include “nRF24L01.h”

#define RF_CS 9
#define RF_CSN 10
RF24 radio(RF_CS, RF_CSN);
const uint64_t pipes[2] = { 0xe7e7e7e7e7LL, 0xc2c2c2c2c2LL };

struct sensor_struct{
int sensor_id;
float temp;
float soil_temp;
float humid;
float pres;
};

void setup() {
Serial.begin(9600);
printf_begin();
radio.begin();
radio.openWritingPipe(pipes[1]); // note that our pipes are the same above, but that
radio.openReadingPipe(1, pipes[0]); // they are flipped between rx and tx sides.
radio.startListening();
radio.printDetails();
}

void loop() {
if (radio.available()) {

Serial.println("--------------------------------------------------------------------------------");
uint8_t rx_data[32]; // we’ll receive a 32 byte packet

bool done = false;
while (!done) {
done = radio.read( &rx_data, sizeof(rx_data) );////problem here only
printf(“Got payload @ %lu…\r\n”, millis());
}

// echo it back real fast
radio.stopListening();
radio.write( &rx_data, sizeof(rx_data) );
Serial.println(“Sent response.”);
radio.startListening();

// do stuff with the data we got.
Serial.print("First Value: ");
Serial.println(rx_data[0]);

}
}

problem in :38th line

thanks in advance

Arduino: 1.6.1 (Windows 8.1), Board: “Arduino Uno”

pro_micro_receive_nrf24l01.ino: In function ‘void loop()’:

pro_micro_receive_nrf24l01.ino:38:12: error: void value not ignored as it ought to be

Error compiling.

This report would have more information with
“Show verbose output during compilation”
enabled in File > Preferences.

My eyes went squiffy trying to count your lines. Is it too much trouble for you to highlight the line with arrows say? And use code tags.

Like this:

yadda yadda
blah blah blah <<<<<<<<<<<<<<<<< this is the line
yadda yadda

Also you might like to expand on what the problem as given in the title, really means.

Hmmm ok so you edited the post without saying that the part you added was an edit, so now my post looks silly.

I can't see any problem at line 38

What this message means, is that you called some function with return type "void" ( meaning, the function does not return a result ), and then tried to use that non-existent result.

sorry for inconvenience pls look now

How to solve that issue
#michinyon

salaideva:
How to solve that issue
#michinyon

Don't assign the function to a value, I guess.

Presumably radio.read() is a void function. If you look in whereever it comes from, it will presumably be prefaced by the word "void" which means there is no return value for you to use.

So to do this....

done = radio.read.....

.... makes no sense at all.

Maybe radio.read updates some global variables that you can use?- you'll need to look in the library it comes from.

Check that the radio.read( ) function actually is defined to return a bool result.

done = radio.read( &rx_data, sizeof(rx_data) );////problem here only

The problem in this line, is that the first argument of the radio.read( ) function is supposed to be a pointer to the data buffer.

radio.read(  rx_data, sizeof(rx_data)) ;   // correct
radio.read( &rx_data[0],  sizeof(rx_data))  ;  // also correct

radio.read( &rx_data, sizeof( rx_data )) ;   // not correct

The source code I found for RF24 library appears to state that the radio.read( ) function should return a bool.

So, there does appear to me to be an error in that line, but it seems to be a completely different error to the one the compiler reported.

Try fixing that error and see if the problem goes away. Compilers are unreliable like that, sometimes.

BUT it again shows the same error :frowning:

Is that printf( ) in the next line going to work ? Try replacing that with Serial.println( ). Or are you trying to print somewhere else ?

Try replacing sizeof(rx_data) with 32.

Get rid of the four slashes //// and replace with two.

Try deleting the whole line and typing it in again, to make sure no invisible invalid characters have got in there.

Check the line count again.

The radio.write( ) line appears to have the same error.

Hello had the same problem is to use only the oldest library of RF 24

Hello, the problem here is with the libreries. the sketch is for an older librerie, but you are using a new one., in the installed librarie, the function read() is not boolean, is a void function. this is the cause of the compiling error.
i recommend to use this repo that is the site of the new librerie, with examples maked to this one.
this is the link https://github.com/TMRh20/RF24.
byee.

TMRh20 suggested me this
Instead of this:

if(radio.available()){
  while(done){
    done = radio.read(blah);
  }
}

use this:

while(radio.available()){
  radio.read(blah);
}