ESP-MQTT

Donald_jack
Posts: 2
Joined: Mon Apr 01, 2019 5:17 pm

ESP-MQTT

Postby Donald_jack » Mon Apr 01, 2019 5:40 pm

I am using "espmqtt" library and trying to build my code in esp-idf-v3.1.3. I am able to build the code(using example code inside the library "mqtt_tcp") and connect to CLOUD-MQTT server. But I am unable to send or receive any data. I am using both Eclipse ide (for esp32) and mysys32 to compile my code. Any help would be appreciable.

ESP_cermak
Posts: 69
Joined: Thu Nov 01, 2018 8:32 am

Re: ESP-MQTT

Postby ESP_cermak » Tue Apr 02, 2019 7:07 am

Hi,

The best starting point would be idf 3.2, where esp-mqtt is integrated as component.
If you have to stick with 3.1, then you can easily
* checkout 3.2 separately and copy folders `example/protocols/mqtt/tcp` and `components/mqtt` to your idf 3.1.3 tree
* go to `components/mqtt/esp-mqtt` and checkout `ESP-MQTT_FOR_IDF_3.1`
* modify the example code per your broker settings:

Code: Select all

    esp_mqtt_client_config_t mqtt_cfg = {
        .uri = "mqtt://m24.cloudmqtt.com:PORT",
        .password = "PASSWORD",
        .username = "USERNAME",
        .event_handle = mqtt_event_handler,
    };

Donald_jack
Posts: 2
Joined: Mon Apr 01, 2019 5:17 pm

Re: ESP-MQTT

Postby Donald_jack » Tue Apr 02, 2019 12:51 pm

Thank you very much for your feedback and fast response.

Who is online

Users browsing this forum: MicroController and 92 guests