NRF24l01 Programm not compiling(error: void value not ignored as it ought to be)

Hi everyone,
I am trying to make a simple remote using the NRF module, and the transmitter code works perfectly but the receiver code has an error that i do not understand. can you please tell me what it is and how to solve it?

Here is the transmetter code that works already

#include  <SPI.h>                     .
#include  "RF24.h"                
byte data[1];                       
const uint64_t pipe = 0xF0F0F0F0A1LL; 
RF24 radio(9,10);                     

void setup(){
 pinMode(3, INPUT_PULLUP);            
 pinMode(5, INPUT_PULLUP);         
 pinMode(7, INPUT_PULLUP);            
 radio.begin();                       
 radio.openWritingPipe(pipe);         }

void loop(){
 if(digitalRead(3)==HIGH || digitalRead(5)==HIGH || digitalRead(7)==HIGH){
  data[0]=0;
 }
 if(digitalRead(3)==LOW){
  data[0]=1;
 }
 if(digitalRead(5)==LOW){
  data[0]=2;
 }
 if(digitalRead(7)==LOW){
  data[0]=3;
 }
 radio.write(data, 1);                 
}

and here is the receiver code that is not compiling

#include <SPI.h>                     
#include "RF24.h"                      
byte data[1];                       
boolean var;                       
const uint64_t pipe = 0xF0F0F0F0A1LL;
RF24 radio(9,10);                     

void setup(){
 pinMode(3, OUTPUT);                
 pinMode(5, OUTPUT);                
 pinMode(7, OUTPUT);                   
 radio.begin();                        
 radio.openReadingPipe(1,pipe);         
 radio.startListening();                
}

void loop(){
 if(radio.available()){
   var = false;
   while(!var){
     var = radio.read(data, 1);   
      if(data[0] == 0){
      digitalWrite(3, LOW);
      digitalWrite(5, LOW);
      digitalWrite(7, LOW);
      }
      if(data[0] == 1){
      digitalWrite(3, HIGH);
      }
      if(data[0] == 2){
      digitalWrite(5, HIGH);
      }
      if(data[0] == 3){
      digitalWrite(7, HIGH);
   }
  }
 }

Hello, try this code:

#include <SPI.h>                     
#include "RF24.h"                     
byte data[1];                       
boolean var;                       
const uint64_t pipe = 0xF0F0F0F0A1LL;
RF24 radio(9,10);                     

void setup(){
 pinMode(3, OUTPUT);               
 pinMode(5, OUTPUT);               
 pinMode(7, OUTPUT);                   
 radio.begin();                       
 radio.openReadingPipe(1,pipe);         
 radio.startListening();               
}

void loop(){
 if(radio.available()){
   var = false;
   while(!var){
     var = radio.read(data, 1);   
      if(data[0] == 0){
      digitalWrite(3, LOW);
      digitalWrite(5, LOW);
      digitalWrite(7, LOW);
      }
      if(data[0] == 1){
      digitalWrite(3, HIGH);
      }
      if(data[0] == 2){
      digitalWrite(5, HIGH);
      }
      if(data[0] == 3){
      digitalWrite(7, HIGH);
   }
  }
 }
}

Regards.

arkatakor:
Hi everyone,
I am trying to make a simple remote using the NRF module, and the transmitter code works perfectly but the receiver code has an error that i do not understand.

What makes you believe the transmitter works, when you are not able to compile the receiver?

Drop the var stuff from the radio.read().

if(radio.available()){
   radio.read(data, 1);

The code was written for the old Maniacbug library.

Besides that, I think you use an outdated NRF library (Maniacbug?) but your code was written for the newer tmrh20 RF24 library.

This Simple nRF24L01+ Tutorial may help.

...R