Attempt to write more readable examples

This commit is contained in:
hsaturn
2021-05-13 03:19:34 +02:00
parent c70716a595
commit b228d35ab0

View File

@@ -1,7 +1,5 @@
#include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt #include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt
#include <my_credentials.h>
#define PORT 1883 #define PORT 1883
MqttBroker broker(PORT); MqttBroker broker(PORT);
@@ -14,11 +12,22 @@ MqttBroker broker(PORT);
* | +--------+ | * | +--------+ |
* | | * | |
* +-----------------------------+ * +-----------------------------+
*
* Your ESP will become a MqttBroker.
* You can test it with any client such as mqtt-spy for example
*
*/ */
const char* ssid = "";
const char* password = "";
void setup() void setup()
{ {
Serial.begin(115200); Serial.begin(115200);
if (strlen(ssid)==0)
Serial << "****** PLEASE MODIFY ssid/password *************" << endl;
WiFi.mode(WIFI_STA); WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password); WiFi.begin(ssid, password);