diff --git a/examples/simple-client/simple-client.ino b/examples/simple-client/simple-client.ino index 484959b..84419e5 100644 --- a/examples/simple-client/simple-client.ino +++ b/examples/simple-client/simple-client.ino @@ -1,10 +1,12 @@ -#include #include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt /** Simple Client * * This is the simplest Mqtt client configuration * + * 1 - edit my_credentials.h to setup wifi essid/password + * 2 - change BROKER values (or keep emqx.io test broker) + * * pro - small memory footprint (both ram and flash) * - very simple to setup and use * @@ -13,6 +15,9 @@ * - local publishes takes more time (because they go outside) */ +const char* BROKER = "broker.emqx.io"; +const uint16_t BROKER_PORT = 1883; + #include static float temp=19; @@ -32,8 +37,7 @@ void setup() Serial << "Connected to " << ssid << "IP address: " << WiFi.localIP() << endl; - client.connect("192.168.1.40", 1883); // Put here your broker ip / port - + client.connect(BROKER, BROKER_PORT); // Put here your broker ip / port } void loop() diff --git a/src/TinyMqtt.h b/src/TinyMqtt.h index 63ed8ee..966e3db 100644 --- a/src/TinyMqtt.h +++ b/src/TinyMqtt.h @@ -1,6 +1,10 @@ #pragma once -#include -#include +#ifdef ESP8266 + #include +#elif defined(ESP32) + #include + #include // https://github.com/me-no-dev/AsyncTCP +#endif #include #include #include