Hello, I'm having the error below everytime I try to upload any code into my esp32. The code itself doesn't seem to be the error because it used to work perfectly fine with the same device.
c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientOta.cpp: In member function 'void TLSClientOta::begin(ConnectionHandler&)':
c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientOta.cpp:59:18: error: no matching function for call to 'TLSClientOta::setCACertBundle(const unsigned char [2330])'
59 | setCACertBundle(x509_crt_bundle);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from C:\Users\Miguel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\libraries\NetworkClientSecure\src/WiFiClientSecure.h:2,
from c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientOta.h:62,
from c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientOta.cpp:15:
C:\Users\Miguel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\libraries\NetworkClientSecure\src/NetworkClientSecure.h:76:8: note: candidate: 'void NetworkClientSecure::setCACertBundle(const uint8_t*, size_t)'
76 | void setCACertBundle(const uint8_t *bundle, size_t size);
| ^~~~~~~~~~~~~~~
C:\Users\Miguel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\libraries\NetworkClientSecure\src/NetworkClientSecure.h:76:8: note: candidate expects 2 arguments, 1 provided
c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientMqtt.cpp: In member function 'void TLSClientMqtt::begin(ConnectionHandler&)':
c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientMqtt.cpp:63:18: error: no matching function for call to 'TLSClientMqtt::setCACertBundle(const unsigned char [2330])'
63 | setCACertBundle(x509_crt_bundle);
| ~~~~~~~~~~~~~~~^~~~~~~~~~~~~~~~~
In file included from C:\Users\Miguel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\libraries\NetworkClientSecure\src/WiFiClientSecure.h:2,
from c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientMqtt.h:62,
from c:\Users\Miguel\OneDrive\Documentos\Arduino\libraries\ArduinoIoTCloud\src\tls\utility\TLSClientMqtt.cpp:15:
C:\Users\Miguel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\libraries\NetworkClientSecure\src/NetworkClientSecure.h:76:8: note: candidate: 'void NetworkClientSecure::setCACertBundle(const uint8_t*, size_t)'
76 | void setCACertBundle(const uint8_t *bundle, size_t size);
| ^~~~~~~~~~~~~~~
C:\Users\Miguel\AppData\Local\Arduino15\packages\esp32\hardware\esp32\3.0.4\libraries\NetworkClientSecure\src/NetworkClientSecure.h:76:8: note: candidate expects 2 arguments, 1 provided
Likely you have a problem with the code expecting some version of some library and some other version of that library is actually being invoked by the compiler.
Well, I've tried with some other projects and all of them didn't work... Here's the code anyway:
#include "arduino_secrets.h"
/*
Sketch generated by the Arduino IoT Cloud Thing "Untitled"
https://create.arduino.cc/cloud/things/f9b146a8-b0b3-401f-b2ef-fac2b764c313
Arduino IoT Cloud Variables description
The following variables are automatically generated and updated when changes are made to the Thing
int solo_moisture_level;
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"
int soil_sensor = 34;
int humidade;
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);
// 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
humidade = map(analogRead(soil_sensor), 4092, 0, 0, 100);
solo_moisture_level = humidade;
}
you could be having problems with the Migration from ESP32 Arduino Core 2.x to 3.0
see ESP32 migration_guides/2.x_to_3.0
use the Tools>Board then board manager to check what version of the ESP32 core are you using
you could try installing version 2.0.17 and see if that fixes your problems
Hi @miigueruh. There was a breaking change in the 3.0.4 release of the 3rd party "esp32" boards platform which causes this error when you try to compile the ArduinoIoTCloud library for an ESP32-based board.
The compatibility of the library has already been restored:
However, that fix was made after the time of the last release of the ArduinoIoTCloud library so it is currently only available when using the beta tester version of the library.
I'll provide instructions you can follow to install the version of the library with the fix:
Select Download ZIP from the menu.
A download of the ZIP file of the library will start.
Wait for the download to finish.
Select Sketch > Include library > Add .ZIP Library from the Arduino IDE menus.
The "Select the zip file containing the library you'd like to add" dialog will open.
Select the downloaded file from the dialog.
Click the "Open" button.
A "Do you want to overwrite the existing library?" dialog will open. Click the "YES" button in the dialog.
The dialog will close.
Wait for the installation process to finish, as indicated by a notification at the bottom right corner of the Arduino IDE window:
ⓘ Successfully installed library from ...
Now try compiling your sketch again. This time the compilation should succeed without the errors you encountered when using the release version of the ArduinoIoTCloud library.
hopefully the fix suggested by @ptillisch should enable you to use V3.0.4
I have projects which are OK using V3 but some which have to use V2 because of library problems
You are welcome. I'm glad if I was able to be of assistance.
Yes, just to be clear, the fix I described above is for use if you want to use version >= 3.0.4 of the "esp32" boards platform. If you instead use the alternative workaround of installing version 3.0.3 or older of the platform (you don't need to go all the way back to 2.0.17), then the fix I described is not necessary (though it also doesn't do any harm since the ArduinoIoTCloud library fix was implemented in a manner that preserves backwards compatibility with older versions of the "esp32" boards platform.