I am getting the error:
void value not ignored as it ought to be
Can someone please help me solve this (I’m not a pro Arduino coder)?
When I compile it, I get the error on line 79:
done = radio.read( received_data, num_received_data );
I don’t know how to solve it, or even what is happening here.
#include <Servo.h>
#include <SPI.h>
#include "nRF24L01.h"
#include "RF24.h"
#include "printf.h"
RF24 radio(9,10);
Servo CH1;
Servo CH2;
Servo CH3;
Servo CH4;
Servo CH5;
Servo CH6;
int ch1;
int ch2;
int ch3;
int ch4;
int ch5;
int ch6;
const int CH7 = 4;
const int CH8 = 3;
const int CH9 = 5;
const int CH10 = 2;
const int SIGNAL = 7;
const uint64_t pipe = 0xE8E8F0F0E1LL;
uint8_t received_data[12];
uint8_t num_received_data =sizeof(received_data);
void setup(void)
{
delay(3000);
CH1.attach(15); //right-y(AIL)
CH2.attach(16); //right-x(ELE)
CH3.attach(19); //vol-batt (CH6)
CH4.attach(18); //left-x (CH5)
CH5.attach(17); //left-y (RUD)
CH6.attach(14); //throt
pinMode(CH7, OUTPUT);
pinMode(CH8, OUTPUT);
pinMode(CH9, OUTPUT);
pinMode(CH10, OUTPUT);
pinMode(SIGNAL, OUTPUT);
Serial.begin(57600);
printf_begin();
printf("nrRF24/Reciever/nr");
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
radio.printDetails();
}
void loop(void)
{
if ( radio.available() )
{
digitalWrite(SIGNAL, HIGH) ;
}
else {
digitalWrite(SIGNAL, LOW) ;
}
bool done = false;
int ESC_value;
while (!done)
{
done = radio.read( received_data, num_received_data );
//////////////PWM//////////////
ch1=(received_data[1]);
ch1=ch1+3;
CH1.write(ch1);
ch2=(received_data[2]);
ch2=ch2+4;
CH2.write(ch2);
ch3=(received_data[3]);
ch3=ch3+4;
CH3.write(ch3);
ch4=(received_data[4]);
ch4=ch4+4;
CH4.write(ch4);
ch5=(received_data[5]);
ch5=ch5+4;
CH5.write(ch5);
ch6=(received_data[6]);
ch6=ch6+4;
CH6.write(ch6);
//////////////0-1//////////////
if ((received_data[7])>100) {
digitalWrite(CH7, HIGH);
}
else {
digitalWrite(CH7, LOW);
}
//////////////
if ((received_data[8])>100) {
digitalWrite(CH8, HIGH);
}
else {
digitalWrite(CH8, LOW);
}
printf("nr");
Serial.print("ROL:");Serial.print(radio.available()); Serial.print("t");
Serial.print("PITCH:");Serial.print((received_data[2])); Serial.print("t");
Serial.print("THROT:");Serial.print((received_data[1])); Serial.print("t");
}
}
I will upload it on an atmega328p for my DIY RC controller.
New contributor
Yasin Khoshab is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.
4