Release 0.3.0

clients can now connect to outside.
bug fixed for broker (pings etc.)
crashes fixed when clients where removed
More examples added (the tinymqtt-test is great)
This commit is contained in:
hsaturn
2021-03-21 13:50:42 +01:00
parent 4e629bbc1e
commit 428eb51850
7 changed files with 632 additions and 71 deletions

View File

@@ -2,31 +2,35 @@
#include "TinyMqtt.h" // https://github.com/hsaturn/TinyMqtt
#include <Streaming.h> // https://github.com/janelia-arduino/Streaming
const char *ssid = ; // Put here your wifi SSID ("ssid")
const char *password = ; // Put here your Wifi password ("pwd")
/** Simple Client
*
* This is the simplest Mqtt client configuration
*
* pro - small memory footprint (both ram and flash)
* - very simple to setup and use
*
* cons - cannot work without wifi connection
* - stop working if broker is down
* - local publishes takes more time (because they go outside)
*/
#define PORT 1883
MqttBroker broker(PORT);
#include <my_credentials.h>
void setup()
{
Serial.begin(115200);
delay(500);
Serial << "Simple clients with wifi " << endl;
WiFi.mode(WIFI_STA);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial << '.';
delay(500);
}
Serial << "Connected to " << ssid << "IP address: " << WiFi.localIP() << endl;
while (WiFi.status() != WL_CONNECTED)
{ delay(500); Serial << '.'; }
broker.begin();
Serial << "Broker ready : " << WiFi.localIP() << " on port " << PORT << endl;
Serial << "Connected to " << ssid << "IP address: " << WiFi.localIP() << endl;
}
void loop()
{
broker.loop();
}