Hello
I'm new to the forum. I apologize in advance for my poor English.
I have a problem compiling code from Arduino IoT Cloud to Arduino IDE.
The code is clean without modifications. While compiling, there are constant errors as below. I uninstalled the Arduino IDE and the libraries but the errors are still there. Please give me some advice on how to improve it.
I use a ESP32 DEV MODULE.
I tested the code on many different ESP32 modules. Unfortunately, the same errors are everywhere.
In file included from c:\Users\weles\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloud.h:167,
from H:\IOT_ARDUINO\Weles\Weles\thingProperties.h:3,
from H:\IOT_ARDUINO\Weles\Weles\Weles.ino:20:
c:\Users\weles\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloudTCP.h:142:16: error: cannot declare field 'ArduinoIoTCloudTCP::_mqttClient' to be of abstract type 'MqttClient'
142 | MqttClient _mqttClient;
| ^~~~~~~~~~~
In file included from c:\Users\weles\Documents\Arduino\libraries\ArduinoMqttClient\src/ArduinoMqttClient.h:23,
from c:\Users\weles\Documents\Arduino\libraries\ArduinoIoTCloud\src/ArduinoIoTCloudTCP.h:27:
c:\Users\weles\Documents\Arduino\libraries\ArduinoMqttClient\src/MqttClient.h:42:7: note: because the following virtual functions are pure within 'MqttClient':
42 | class MqttClient : public Client {
| ^~~~~~~~~~
In file included from C:\Users\weles\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0-RC3\cores\esp32/Arduino.h:197,
from C:\Users\weles\AppData\Local\arduino\sketches\E93321053340A96E0FF440733028DB0E\sketch\Weles.ino.cpp:1:
C:\Users\weles\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0-RC3\cores\esp32/Client.h:29:15: note: 'virtual int Client::connect(IPAddress, uint16_t, int32_t)'
29 | virtual int connect(IPAddress ip, uint16_t port, int32_t timeout) = 0;
| ^~~~~~~
C:\Users\weles\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0-RC3\cores\esp32/Client.h:31:15: note: 'virtual int Client::connect(const char*, uint16_t, int32_t)'
31 | virtual int connect(const char *host, uint16_t port, int32_t timeout) = 0;
| ^~~~~~~
Multiple libraries were found for "WiFi.h"
Used: C:\Users\weles\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.1.0-RC3\libraries\WiFi
Not used: C:\Users\weles\Documents\Arduino\libraries\WiFiNINA
exit status 1
Compilation error: exit status 1
Weles.zip (5.7 KB)
Kod programu:
#include "arduino_secrets.h"
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/3d149b89-b467-4d9b-9e3f-c57f1f43607a
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int lED_1_VALUE;
int lED_2_VALUE;
bool lED_1_STATUS;
bool lED_2_STATUS;
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"
void setup() {
// Initialize serial and wait for port to open:
Serial.begin(115200);
// This delay gives the chance to wait for a Serial Monitor without blocking if none is found
delay(1500);
// 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();
// Your code here
}
/*
Since LED1STATUS is READ_WRITE variable, onLED1STATUSChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLED1STATUSChange() {
// Add your code here to act upon LED1STATUS change
}
/*
Since LED2STATUS is READ_WRITE variable, onLED2STATUSChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLED2STATUSChange() {
// Add your code here to act upon LED2STATUS change
}
/*
Since LED1VALUE is READ_WRITE variable, onLED1VALUEChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLED1VALUEChange() {
// Add your code here to act upon LED1VALUE change
}
/*
Since LED2VALUE is READ_WRITE variable, onLED2VALUEChange() is
executed every time a new value is received from IoT Cloud.
*/
void onLED2VALUEChange() {
// Add your code here to act upon LED2VALUE change
}