Bonjour,
J'ai besoin d'un actionneur à distance et j'ai trouvé sur Internet les codes TX et RX qui correspondent à mon projet (Wiring the NRF24L01 2.4GHz Radio as Remote Switching | 14core.com).
Ce projet est à base d'Arduino bien sûr et d'émetteur/récepteur NRF24L01+.
Le code du récepteur est le suivant :
/*
14CORE NRF24L01 SLAVE/RECIEVER
*/
#include <SPI.h> //Include SPI Code Library which can be downloaded below
#include "nRF24L01.h" //Include NRF24L01 Code Library which can be downloaded below
#include "RF24.h" //Inlcude NRF24 Code Library which can be downloaded below
int msg[1];
RF24 radio(9,10); // NRF24L01 Pin
const uint64_t pipe = 0xE8E8F0F0E1LL; //Start Pipe Communication Address
int Indicator = 3; //This the LED which is connected to Arduino Pin 3
void setup(void){
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(1,pipe);
radio.startListening();
pinMode(Indicator, OUTPUT);}
void loop(void){
if (radio.available()){
bool done = false;
while (!done){
done = radio.read(msg, 1);
Serial.println(msg[0]);
if (msg[0] == 111){delay(10);digitalWrite(Indicator, HIGH);}
else {digitalWrite(Indicator, LOW);}
delay(10);}}
else{Serial.println("Error: No Radio Transmission");}}
Lors de la compilaton j'ai une erreur sur la ligne 25
done = radio.read(msg, 1);
avec le message suivant :
"Atelier_NRF24L01_recepteur:25: error: void value not ignored as it ought to be
- done = radio.read(msg, 1); *
- ^*
exit status 1
void value not ignored as it ought to be"
Je n'arrive pas à solutionner ce problème car je ne comprends pas le message, ni les 2 lignes précédentes :
bool done = false;
while (!done){
Merci de votre aide pour résoudre ce problème.