Demande d'aide

ADOU
ven, 01/04/2019 - 00:02
BONSOIR
J'AI BESOIN DE VOTRE AIDE
JE VIENS DE COMMENCER A MONTER MON ROBOT QUADRIPODE QUAND JE TELEVERSE LE PROGRAMME çA ME DONNE SA
:\Users\DJIGUIBA\Downloads\CD\CD\code\2.nrf24l01\Receive\Receive.ino: In function 'void loop()':
Receive:67:12: error: void value not ignored as it ought to be
done = radio.read( joystick, sizeof(joystick) );
^
exit status 1
void value not ignored as it ought to be
VOILA LE CODE SOURCE
/* -----------------------------------------------------------------------------
- File: nRF24l01 Receive Test
- Copyright: Copyright (C) 2015 SunFounder. For details, check License folder.
- Date: 2015/7/21
* -----------------------------------------------------------------------------
- Overview
- This project was written to test nRF24l01 module. If it runs, arduino will
receives data from another transceiver with 2 Analog values from a Joystick
or 2 Potentiometers Displays received values on Serial Monitor.
- Request
- FR24 library
- Connections
- nRF24L01 to Arduino
1 GND GND
2 VCC 3V3
3 CE D9
4 CSN D10
5 SCK D13
6 MOSI D11
7 MISO D12
8 UNUSED
* ---------------------------------------------------------------------------*/
/* Includes ------------------------------------------------------------------*/
#include <SPI.h>
#include <nRF24L01.h>
#include <RF24.h>
/* Ports ---------------------------------------------------------------------*/
#define CE_PIN 9
#define CSN_PIN 10
/* nRF24l01 ------------------------------------------------------------------*/
// NOTE: the "LL" at the end of the constant is "LongLong" type
const uint64_t pipe = 0xE8E8F0F0E1LL; // Define the transmit pipe
RF24 radio(CE_PIN, CSN_PIN); // Create a Radio
/* Joystick ------------------------------------------------------------------*/
int joystick[2]; // 2 element array holding Joystick readings
/* ---------------------------------------------------------------------------*/
/*
- setup function
* ---------------------------------------------------------------------------*/
void setup()
{
Serial.begin(9600);
delay(1000);
Serial.println("nRF24l01 Receiver Starting");
radio.begin();
radio.setRetries(0, 15);
radio.setPALevel(RF24_PA_HIGH);
radio.openReadingPipe(1,pipe);
radio.startListening();;
}
/*
- loop function
* ---------------------------------------------------------------------------*/
void loop()
{
if ( radio.available() )
{
Serial.println("serial");
// Read the data payload until we've received everything
bool done = false;
while (!done)
{
// Fetch the data payload
done = radio.read( joystick, sizeof(joystick) );
Serial.print("X = ");
Serial.print(joystick[0]);
Serial.print(" Y = ");
Serial.println(joystick[1]);
}
}
else
{
Serial.println("No radio available");
}
}
MERCI D'AVANCE
Walter
ven, 01/04/2019 - 12:32
Bonjour, l'erreur indique que tu essaye d'affecter à une variable le retour d'une fonction vide.
Dans la classe RF24 la fonction read est sans retour (void), tu ne peux donc pas t'en servir pour savoir si il y a encore des choses à lire.
Il faut utiliser la fonction "available", comme dans ton if et dans le code proposé par Spy, pour savoir si tu as encore des choses à lire.
ADOU
sam, 01/05/2019 - 09:36
Merci a vous