How do I save a radio.read to a value?

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

Servo servo1;
Servo servo2;

RF24 radio(9,10);
const uint64_t pipe=0xE8E8F0F0E1LL;
int data[2];

void setup() {
servo1.attach(5);
servo2.attach(6);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
}

void loop() {
if(radio.available()){
bool done = false;
while (!done){
done = radio.read(data, sizeof(data));
servo1.write(data[0]);
servo2.write(data[1]);
}
{
Serial.println(data[0]);
Serial.println(data[1]);
delay(20);
}
}
}

i am getting error ..please fix error

Welcome to the forum

Please follow the advice given in the link below when posting code, in particular the section entitled 'Posting code and common code problems'

Use code tags (the < CODE/ > icon above the compose window) to make it easier to read and copy for examination

https://forum.arduino.cc/t/how-to-get-the-best-out-of-this-forum

The read() function does not return a value which is why you are getting an error

Try

radio.read(data, sizeof(data));

The value returned by the read() will be put into the data array but may not be what you are expecting

Post the error message. Please edit your post to add code tags.

The error will be something along the lines of

void value not ignored as it ought to be

Can you correct the code and paste here only ..it will be great help

It would be a great help if you followed the instructions.

I don't have much knowledge about coding ..so please correct the code and forward it to me

Please read and follow the instructions in the "How to get the best out of this forum" post.

yes ..this is the error we are getting

The corrected line of code in in reply #3

still i am getting same error .

Post your revised sketch in a new reply

done = radio.read(data,sizeof(data));

Your WHOLE revised sketch

Note what I said in reply #2

radio.read(data, sizeof(data));

Is that what you put in your revised sketch ?

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

Servo servo1;
Servo servo2;

RF24 radio(9,10);
const uint64_t pipe=0xE8E8F0F0E1LL;
int data[32];

void setup() {
servo1.attach(5);
servo2.attach(6);
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
}

void loop() {
if(radio.available()){
bool done = false;
while (!done){
done = radio.read(data, sizeof(data));
servo1.write(data[0]);
servo2.write(data[1]);
}
{
Serial.println(data[0]);
Serial.println(data[1]);
delay(20);
}
}
}

Answer : no
You still used

done = radio.read(data, sizeof(data));

Change it to

 radio.read(data, sizeof(data));

thanks now its working fine

You will never have knowledge about coding if you ask for ready-made answers instead of trying to solve the problem yourself.

And you still not using code tags although you were asked several times to read the forum rules.

You got there in the end