diff --git a/esp/main/main.ino b/esp/main/main.ino new file mode 100644 index 0000000..97c64b3 --- /dev/null +++ b/esp/main/main.ino @@ -0,0 +1,25 @@ +#include +#include + +// WiFi +const char *ssid = "xxxxx"; // Enter your WiFi name +const char *password = "xxxxx"; // Enter WiFi password + +// MQTT Broker +const char *mqtt_broker = ""; +const char *topic = "reinhold/test"; +const int mqtt_port = 1883; +const char *client_id = "m5-esp"; + +Wifi.begin(ssid, password); + +client.setServer(mqtt_broker, mqtt_port); +client.setCallback(callback); +client.connect(client_id.c_str()); + + +void callback(char *topic, byte *payload, unsigned int length) { + for (int i = 0; i < length; i++) { + Serial.print((char) payload[i]); + } +} \ No newline at end of file