Error in program for Nrf24L01

Hi all
Im getting error in compiling the program at line 44 or look at below at bold line. Please help me out
Thanks.

void loop() {

if (radio.available()) {

bool done = false;
while (!done) {

done = radio.read( data, sizeof(data) );
//
x = data[0];
y = data[1];
}
}
}

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

#define CE_PIN   9
#define CSN_PIN 10

const uint64_t pipe = 0xE8E8F0F0E1LL;

RF24 radio(CE_PIN, CSN_PIN);

int data[4];

//definicja serwa
Servo myservoX, myservoY;
//definicja pinów dla steronika silników
int pwmMotorA = 6;
int pwmMotorB = 3;
int ForwardA = 8;
int BackA = 7;
int ForwardB = 5;
int BackB = 4;
int x, y, servoX, servoY;




void setup() {

  Serial.begin(115200);
  radio.begin();
  radio.openReadingPipe(1, pipe);
  radio.startListening();;

}
void loop() {

  if (radio.available()) {

    bool done = false;
    while (!done) {

      done = radio.read(data, sizeof(data) );
      //
      x = data[0];
      y = data[1];
    }
  }
}

RCTANK.ino (735 Bytes)

You've defined done as having a value of true (1) or false (0).
Then giving it a totally value with

done = radio.read( data, sizeof(data) );
[code]
which is apparently at least 2 since you have data[0] and data[1]
I think you want to set done = true; after populating the array, and use a different variable to put the radio.read data into.

Abhishek_Kuksal:
Im getting error in compiling the program at line 44 ...

PLEASE post the complete error message.

But I'm guessing this Will solve your problem:

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

The code in the Original Post looks correct. That read() function returns true or false.

As others have hinted at the problem is probably in the code we can't see.

Post the full program and the text of the error message.

And please use the code button </> so your code looks like this and is easy to copy to a text editor. Also for the error message.

...R

giova014:
PLEASE post the complete error message.

But I'm guessing this Will solve your problem:

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

Arduino: 1.6.4 (Windows 8.1), Board: "Arduino Mega or Mega 2560, ATmega2560 (Mega 2560)"

RCTANK.ino: In function 'void loop()':
RCTANK:44: error: void value not ignored as it ought to be
void value not ignored as it ought to be

This was the erreo that im getting

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

#define CE_PIN   9
#define CSN_PIN 10

const uint64_t pipe = 0xE8E8F0F0E1LL;

RF24 radio(CE_PIN, CSN_PIN);

int data[4];

//definicja serwa
Servo myservoX, myservoY;
//definicja pinów dla steronika silników
int pwmMotorA = 6;
int pwmMotorB = 3;
int ForwardA = 8;
int BackA = 7;
int ForwardB = 5;
int BackB = 4;
int x, y, servoX, servoY;




void setup() {

  Serial.begin(115200);
  radio.begin();
  radio.openReadingPipe(1, pipe);
  radio.startListening();;

}
void loop() {

  if (radio.available()) {

    bool done = true;
    while (!done) {

      done = radio.read(&data, sizeof(data) );
      //
      x = data[0];
      y = data[1];
    }
  }
}

The code in Reply #4 compiles perfectly for me for an Uno on IDE 1.5.6

I suspect there may be something in the library that the newer version of the IDE objects to. Alas the Arduino folks don't seem to have heard of backwards compatibility.

It is easy to have several version of the IDE on your PC.

...R

Robin2:
The code in Reply #4 compiles perfectly for me for an Uno on IDE 1.5.6

I suspect there may be something in the library that the newer version of the IDE objects to. Alas the Arduino folks don't seem to have heard of backwards compatibility.

It is easy to have several version of the IDE on your PC.

...R

Thank you all ultimately all i had to change my nrf library cause the one i had download is full of bugs i issues a new copy of that now its is compiling successfully.
Thank you all.