Bonjour à tous,
Je suis nouveau sur ce forum et je vous prie d'excuser mes maladresses. J'ai quelques expériences basiques (datalogger, RTC, SD-Card, gestion d'un chauffe eau...) mais je débute avec WebEditor et iOT.
J'ai un code très simple qui se compile sans erreur en local sur IDE 2.1.0.
HW : Arduino UNOR4 WIFI
Sur WebEditor, la compilation est stoppée "exit status 1".
Ci après
le sketch qui fonctionne (édité avec IDE)
le sketch qui ne se compile pas (avec WebEditor)
le message d'erreur généré par WebEditor
// test_UNOR4_2-4GHz_IDE210
// edited and compiled on laptop
// the sketch receives two float values from 2.4GHz receiver every 6.9sec
//
#include <RF24.h>
#include <RF24_config.h>
#include <nRF24L01.h>
#include <printf.h>
#include <SPI.h>
//Variables
float extTemp; // temperature extérieure reçue par radio
float extHum;
bool beep;
struct Data_Package {
float a;
float b;
bool c;
};
Data_Package data;
RF24 radio(7, 8); // CE, CSN
const byte address[6] = "00001";
void setup() {
Serial.begin(9600);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RF24_PA_MIN);
radio.setDataRate(RF24_250KBPS);
radio.startListening();
}
void loop() {
if (radio.available()) {
char text[32] = "";
radio.read(&data, sizeof(Data_Package));
extTemp = data.a;
extHum = data.b;
beep = data.c;
Serial.print("extTemp= ");
Serial.print(extTemp);
Serial.print(" extHum= ");
Serial.print(extHum);
Serial.print(" ");
Serial.println(beep);
}
} // fin loop
Voici le code généré par Arduino iOT dans lequel on retrouve le code précédent
//
// edited and compiled on Webeditor
// the sketch receive two floaat values and a bool value
// RF24 - Version: Latest
#include <RF24.h>
#include <RF24_config.h>
#include <nRF24L01.h>
#include <printf.h>
#include <SPI.h>
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/f89a01d1-123b-44a9-a566-8cf078ca4dc1
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
float extHum;
float extTemp;
Variables which are marked as READ/WRITE in the Cloud Thing will also have functions
which are called when their values are changed from the Dashboard.
These functions are generated with the Thing and added at the end of this sketch.
*/
#include "thingProperties.h"
bool beep;
struct Data_Package {
float a;
float b;
bool c;
};
Data_Package data;
RF24 radio(7, 8); // CE,CSN
const byte address[6] = "00001";
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(9600);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
radio.begin();
radio.openReadingPipe(0, address);
radio.setPALevel(RFA_PA_MIN);
radio.setDataRate(RF24_250KBPS);
radio.startListening;
// Defined in thingProperties.h
initProperties();
// Connect to Arduino IoT Cloud
ArduinoCloud.begin(ArduinoIoTPreferredConnection);
/*
The following function allows you to obtain more information
related to the state of network and IoT Cloud connection and errors
the higher number the more granular information you’ll get.
The default is 0 (only errors).
Maximum is 4
*/
setDebugMessageLevel(2);
ArduinoCloud.printDebugInfo();
}
void loop() {
ArduinoCloud.update();
// enter your code here
if (radio.available()) {
char text[32] = "";
radio.read(&data, sizeof(Data_Package));
extTemp = data.a;
extHum = data.b
beep = data.c;
Serial.print("extTemp= ");
Serial.print(extTemp);
Serial.print(" extHum= ");
Serial.print(extHum);
Serial.print(" ");
Serial.print(beep);
}
}
Et voici le message d'erreur généré par le compilateur du WebEditor
/usr/local/bin/arduino-cli compile --fqbn arduino:renesas_uno:unor4wifi --build-cache-path /tmp --output-dir /tmp/3315857571/build --build-path /tmp/arduino-build-C76BA2E7BD3F213ECD47F4386C076A7F /tmp/3315857571/20230830_R4_2-4GHz_aug30a
In file included from /tmp/3315857571/20230830_R4_2-4GHz_aug30a/20230830_R4_2-4GHz_aug30a.ino:9:0:
/home/builder/Arduino/libraries/rf24_1_4_7/nRF24L01.h:35:21: error: expected identifier before numeric constant
#define CD 0x09
^
/home/builder/Arduino/libraries/arduinoiotcloud_1_12_0/src/cbor/../property/types/automation/CloudTelevision.h:52:3: note: in expansion of macro 'CD'
CD = 9,
^~
/home/builder/Arduino/libraries/rf24_1_4_7/nRF24L01.h:36:21: error: expected '}' before numeric constant
#define CD 0x09
^
/home/builder/Arduino/libraries/arduinoiotcloud_1_12_0/src/cbor/../property/types/automation/CloudTelevision.h:52:3: note: in expansion of macro 'CD'
CD = 9,
^~
/home/builder/Arduino/libraries/rf24_1_4_7/nRF24L01.h:36:21: error: expected unqualified-id before numeric constant
#define CD 0x09
^
/home/builder/Arduino/libraries/arduinoiotcloud_1_12_0/src/cbor/../property/types/automation/CloudTelevision.h:52:3: note: in expansion of macro 'CD'
CD = 9,
^~
In file included from /home/builder/Arduino/libraries/arduinoiotcloud_1_12_0/src/cbor/../property/PropertyContainer.h:55:0,
from /home/builder/Arduino/libraries/arduinoiotcloud_1_12_0/src/cbor/CBORDecoder.h:35,
from /home/builder/Arduino/libraries/arduinoiotcloud_1_12_0/src/ArduinoIoTCloud.h:35,
from /tmp/3315857571/20230830_R4_2-4GHz_aug30a/thingProperties.h:3,
from /tmp/3315857571/20230830_R4_2-4GHz_aug30a/20230830_R4_2-4GHz_aug30a.ino:29:
/home/builder/Arduino/libraries/arduinoiotcloud_1_12_0/src/cbor/../property/types/automation/CloudTelevision.h:104:1: error: expected declaration before '}' token
};
^
Multiple libraries were found for "RTC.h"
Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.2/libraries/RTC
Not used: /home/builder/opt/libraries/m5stickcplus_0_0_9
Not used: /home/builder/opt/libraries/m5core2_0_1_6
Not used: /home/builder/opt/libraries/m5stickc_0_2_9
Not used: /home/builder/opt/libraries/m5station_0_0_1
Multiple libraries were found for "SPI.h"
Used: /home/builder/.arduino15/packages/arduino/hardware/renesas_uno/1.0.2/libraries/SPI
Not used: /home/builder/opt/libraries/eventethernet_1_0_0
Error during build: exit status 1
Je suis un peu perplexe ; le code se compile sans problème en local avec IDE et plante avec le compilateur du WebEditor. Le message d'erreur est très ésotérique pour moi. Avez-vous une idée de ce qui se passe? Merci par avance pour votre aide.