From 4a4ddc1d282e59c8ce91d0b543d8ab8f4894de05 Mon Sep 17 00:00:00 2001 From: KenwoodFox Date: Tue, 27 Apr 2021 17:05:14 -0400 Subject: [PATCH] This code beeping beeps! --- window_control/window_control.ino | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/window_control/window_control.ino b/window_control/window_control.ino index e85d076..602b465 100644 --- a/window_control/window_control.ino +++ b/window_control/window_control.ino @@ -14,6 +14,10 @@ #define mqtt_user SECRET_MQTT_USER #define mqtt_password SECRET_MQTT_PASS + +#define window_name "window_0" +#define mqtt_root "/house/upstairs_lab/actuators/" window_name + #define in_topic "/testing/in" #define out_topic "/testing/out" // Replace by 2 if you aren't enable to use Serial Monitor... Don't forget to Rewire R1 to GPIO2! @@ -38,7 +42,7 @@ void setup_wifi() { delay(10); // We start by connecting to a WiFi network Serial.println(); - WiFi.hostname("ESP-Test1"); + WiFi.hostname("ESP-" window_name); Serial.print("Connecting to "); Serial.println(wifi_ssid); @@ -60,8 +64,6 @@ void reconnect() { while (!client.connected()) { Serial.print("Attempting MQTT connection..."); // Attempt to connect - // If you do not want to use a username and password, change next line to - // if (client.connect("ESP8266Client")) { if (client.connect("ESP8266Client", mqtt_user, mqtt_password)) { Serial.println("connected"); } else { @@ -98,5 +100,6 @@ void loop() { client.publish(out_topic, String(random(2)).c_str(), true); delay(1000); client.subscribe(in_topic); + tone(2, 2000, 500); delay(1000); }