Example 03 - ProjectUNION MQTT
=========================================

Purpose
-------
This example demonstrates the ProjectUNION MQTT library using the same
reference hardware as the Starter example.

Hardware
--------
OLED SDA      GPIO21
OLED SCL      GPIO22
Green LED     GPIO16 through 330 ohm resistor to GND
Red LED       GPIO17 through 330 ohm resistor to GND
Push button   GPIO0 to GND

Required libraries
------------------
ProjectUNION Core 0.3.3 or newer
ProjectUNION MQTT 0.3.2 or newer
PubSubClient
Adafruit GFX Library
Adafruit SSD1306

Default hostname
----------------
union-mqtt-demo.local

First setup
-----------
1. Upload the sketch.
2. Connect to the access point UNION-MQTT-Setup.
3. Enter the normal WiFi settings.
4. Open http://union-mqtt-demo.local
5. Open MQTT in the menu and configure the broker.
6. Enable MQTT and save.
7. Use the Test button on the MQTT page.

Default MQTT topics
-------------------
ProjectUNION/Demo/green/set      Payload: ON or OFF
ProjectUNION/Demo/red/set        Payload: ON or OFF
ProjectUNION/Demo/display/text   Payload: any short text
ProjectUNION/Demo/button/event   Published by the physical button

Published LED states
--------------------
ProjectUNION/Demo/green/state
ProjectUNION/Demo/red/state

The LED state topics are retained.

OLED
----
Short button press:
- Changes OLED page
- Publishes the current button press count

Long button press:
- Switches the OLED display on or off

Notes
-----
GPIO0 is also an ESP32 boot strapping pin. Do not hold the push button
while powering or resetting the ESP32.
