• Skip to main content
  • Skip to primary sidebar

RNTLab.com

The Ultimate Shortcut to Learn Electronics and Programming with Open Source Hardware and Software

  • Courses
  • Forum
    • Forum
    • Ask Question
  • Shop
  • Account
  • Blog
  • Login

Module 5.2Publish and subscribe

Q&A Forum › Module 5.2Publish and subscribe
0 Vote Up Vote Down
Neville Leah asked 1 year ago
7 Answers
0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
Can you provide more details about your issue?
Regards,
Sara

0 Vote Up Vote Down
Neville Leah answered 1 year ago

Really sorry I thought I’d submitted a link to my problem! Obviously not.___ I’m using the latest version of Visual Studio on Win10. I’ve entered the correct board and downloaded the correct library for Asyncmqttclient. The code is from Module 5.2(Publish and Subscribe – ESP32) Previous scripts with this board and .ini  setup have worked fine. The Monitor print out gives the following when I attempt to download.
Processing az-delivery-devkit-v4 (platform: espressif32; board: az-delivery-devkit-v4; framework: arduino)
—————————————————————————————————————————Verbose mode can be enabled via `-v, –verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/espressif32/az-delivery-devkit-v4.html
PLATFORM: Espressif 32 (3.1.0) > AZ-Delivery ESP-32 Dev Kit C V4
HARDWARE: ESP32 240MHz, 520KB RAM, 16MB Flash
DEBUG: Current (esp-prog) External (esp-prog, iot-bus-jtag, jlink, minimodule, olimex-arm-usb-ocd, olimex-arm-usb-ocd-h, olimex-arm-usb-tiny-h, olimex-jtag-tiny, tumpa)
PACKAGES:
– framework-arduinoespressif32 @ 3.10005.210308 (1.0.5)
– tool-esptoolpy @ 1.30000.201119 (3.0.0)
– tool-mkspiffs @ 2.230.0 (2.30)
– toolchain-xtensa32 @ 2.50200.97 (5.2.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 32 compatible libraries
Scanning dependencies…
Dependency Graph
|– AsyncMqttClient @ 0.9.0
|– AsyncMqttClient-esphome @ 0.8.6
|– WiFi @ 1.0
Building in release mode
Compiling .pio\build\az-delivery-devkit-v4\src\main.cpp.o
Compiling .pio\build\az-delivery-devkit-v4\lib3c1\AsyncMqttClient\AsyncMqttClient\Packets\PingRespPacket.cpp.o
Compiling .pio\build\az-delivery-devkit-v4\lib3c1\AsyncMqttClient\AsyncMqttClient\Packets\PubAckPacket.cpp.o
Compiling .pio\build\az-delivery-devkit-v4\lib3c1\AsyncMqttClient\AsyncMqttClient\Packets\PubCompPacket.cpp.o
Compiling .pio\build\az-delivery-devkit-v4\lib3c1\AsyncMqttClient\AsyncMqttClient\Packets\PubRecPacket.cpp.o
src\main.cpp: In function ‘void WiFiEvent(system_event_id_t)’:
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_WIFI_READY’ not handled in switch [-Wswitch]
switch(event) {
^
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_SCAN_DONE’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_START’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_STOP’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_CONNECTED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_AUTHMODE_CHANGE’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_LOST_IP’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_SUCCESS’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_FAILED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_TIMEOUT’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_PIN’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_STA_WPS_ER_PBC_OVERLAP’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_AP_START’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_AP_STOP’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_AP_STACONNECTED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_AP_STADISCONNECTED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_AP_STAIPASSIGNED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_AP_PROBEREQRECVED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_GOT_IP6’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_ETH_START’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_ETH_STOP’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_ETH_CONNECTED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_ETH_DISCONNECTED’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_ETH_GOT_IP’ not handled in switch [-Wswitch]
src\main.cpp:45:9: warning: enumeration value ‘SYSTEM_EVENT_MAX’ not handled in switch [-Wswitch]
src\main.cpp: In function ‘void onMqttMessage(char*, char*, AsyncMqttClientMessageProperties, size_t, size_t, size_t)’:
src\main.cpp:116:20: error: ‘LED_BUILTIN’ was not declared in this scope
digitalWrite(LED_BUILTIN, HIGH);
^
src\main.cpp:119:20: error: ‘LED_BUILTIN’ was not declared in this scope
digitalWrite(LED_BUILTIN, LOW);
^
src\main.cpp: In function ‘void setup()’:
src\main.cpp:149:12: error: ‘LED_BUILTIN’ was not declared in this scope
pinMode (LED_BUILTIN, OUTPUT);
^
*** [.pio\build\az-delivery-devkit-v4\src\main.cpp.o] Error 1
=============================================== [FAILED] Took 45.32 seconds ===============================================
* The terminal process “C:\Users\Admin\.platformio\penv\Scripts\platformio.exe ‘run’, ‘–target’, ‘upload'” terminated with exit code: 1.
* Terminal will be reused by tasks, press any key to close it.

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi.
Please show me your plaformio.ini file.
Regards,
Sara

0 Vote Up Vote Down
Neville Leah answered 1 year ago

The .ini code <

env:az-delivery-devkit-v4]
platform = espressif32
board = az-delivery-devkit-v4
framework = arduino
lib_deps =
    marvinroger/AsyncMqttClient@^0.9.0
    ottowinter/AsyncMqttClient-esphome@^0.8.6
monitor_speed = 115200
>
My 2 concerns are are this and the console readouts:-
>warning: enumeration value ‘SYSTEM_EVENT_STA_START’
 
and
 
>src\main.cpp:149:12: error: ‘LED_BUILTIN’ was not declared in this scope
pinMode (LED_BUILTIN, OUTPUT);
^
*** [.pio\build\az-delivery-devkit-v4\src\main.cpp.o] Error 1

 
If you could help me with these I would be very grateful.
 
Regards
Nev
 

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Hi again.
 
You are using two different MQTT libraries. Is there are specific reason for that?
lib_deps =
    marvinroger/AsyncMqttClient@^0.9.0
    ottowinter/AsyncMqttClient-esphome@^0.8.6
 
I tested it on my ESP32 DOIT and it compiles fine. Only with the marvinroger/AsyncMqttClient@^0.9.0 library.
But, if I select your specific board, it gives that compilation error.
That is probably happening because the LED_BUILTIN is not defined for that specific board.
I’m not sure, but it seems that specific board doesn’t have a built-in LED. Can you confirm that? 
So, you’ll have to replace LED_BUILTIN with a GPIO of your choice and then, wire an LED to that GPIO so that you can visually see what’s going on.
 
I hope this helps.
Let me know if this is clear.
 
Regards,
Sara

0 Vote Up Vote Down
nevleah answered 1 year ago

I’ve searched the spec for my az dev board and can’t find any mention of an on-board programmable led so that must be it! I’m away for 2 weeks so it will have to wait! The second library was my earlier attempt to resolve it, I should have deleted it. Thanks for your super support. 
Nev

0 Vote Up Vote Down
Sara Santos Staff answered 1 year ago

Great.
When you come back, let me know if you were able to solve the issue.
Regards,
Sara

Primary Sidebar

Login to Ask or Answer Questions

This Forum is private and it’s only available for members enrolled in our Courses.

Login »

Latest Course Updates

  • [eBook Updated] Learn LVGL: Build GUIs for ESP32 Projects – Version 1.5 July 7, 2025
  • [eBook Updated] Learn Raspberry Pi Pico/Pico W with MicroPython eBook – Version 1.2 May 26, 2025

You must be logged in to view this content.

Contact Support - Refunds - Privacy - Terms - MakerAdvisor.com - Member Login

Copyright © 2013-2025 · RandomNerdTutorials.com · All Rights Reserved

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.