Unable to compile BasicMQTT - code error
-
I am trying to run the BasicMQTT example but get the following error.
/*****************************************
C:\Users\SteveV\Documents\ESP32_WROOM-Devkit\Projects\BasicMQTT\BasicMQTT.ino: In function 'void setup()':
C:\Users\SteveV\Documents\ESP32_WROOM-Devkit\Projects\BasicMQTT\BasicMQTT.ino:42:3: error: 'ledcSetup' was not declared in this scope
42 | ledcSetup(led::LED_CHANNEL, led::LED_FREQ, led::LED_BITS); // channel, freq, resolution_bits
| ^~~~~~~~~
C:\Users\SteveV\Documents\ESP32_WROOM-Devkit\Projects\BasicMQTT\BasicMQTT.ino:43:3: error: 'ledcAttachPin' was not declared in this scope; did you mean 'ledcAttach'?
43 | ledcAttachPin(led::LED_BUILTIN, led::LED_CHANNEL);
| ^~~~~~~~~~~~~
| ledcAttachexit status 1
Compilation error: 'ledcSetup' was not declared in this scope
*******************************************/I have reloaded the code from the web and from the code snippet - both give same error.
Where are the two functions in error supposed to reside?
Cheers -
@SteveV Hi.
Did you install the esp32 board support? Which version are you using?
Please let me know, so I can help you further.
Best regards,
Kl3m3n -
@kl3m3n G'day Klemen,
I'll try to provide as much info as I can,My physical board is marked "ESP32_DEVKITC_V4"
The ESP32 by Espressif Systems v3.0.1 has been installed.
The "https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json" had been set in preferences.
Unable to specifically find board "ESP32-WROOM-32" (as shown in the video tutorial) - the one that seems to fit closest is uPesy ESP32 Wroom Devkit. (I select com6).
Using this board, I can load TemperatureReader (Episode 1) from the tutorials, set up the network, MQTT in/out compile/run (without error) and run the GUIO on the tablet and everything works perfectly.
As indicated in my last post, I sourced the BasicMQTT code by copying the code snippet as well as downloading from the link in the tutorials just in case there was a code discrepancy
And yet I still get the error previously posted.
Where are the ledc* functions declared? I can't find any reference to them!
I'd appreciate any help as I'm keen to learn more about MQTT for a project I'm developing.
Cheers -
@SteveV Hi.
It seems that the API has changed...
Try using esp32 2.x.x version, until i update the example. I think you should be able to uninstall 3.x.x version and revert back to 2.x.x.
Alternatively, you could modify the "ledc" functions to use the new API.
Best regards,
Kl3m3n -
@kl3m3n Hi Klemen,
That certainly fixed the problem - I went back to v2.0.17
I'm a bit long-in-the tooth and I'm not as switched on as I used to be. Thankfully I (we) have a wonderful mentor in yourself, and one who readily picks up the slack when people like me struggle. Thanks for your on-going support.
Cheers Steve -
Hi,
"The ESP32 by Espressif Systems v3.0.1 has been installed."
With the v3.0.1 my code not compile and show many errors
Install instead v.2.0
Regards
-
@SteveV No problem! Happy to help!
Best regards.
-
@Sato I will update the example, so it is compatible with the new esp32 version.