Compare commits

3 Commits

Author SHA1 Message Date
4a4ddc1d28 This code beeping beeps! 2021-04-27 17:05:14 -04:00
9a64876f07 Add board port to settings 2021-04-27 17:05:05 -04:00
883da0d422 Im not actually sure why my ide thought we needed this file. 2021-04-27 02:07:18 -04:00
3 changed files with 13 additions and 4 deletions

View File

@@ -1,5 +1,6 @@
{
"sketch": "window_control/window_control.ino",
"configuration": "BoardModel=primo,xtal=80,vt=flash,exception=legacy,ssl=all,eesz=4M2M,ip=lm2f,dbg=Disabled,lvl=None____,wipe=none,baud=115200",
"board": "esp8266:esp8266:arduino-esp8266"
"board": "esp8266:esp8266:arduino-esp8266",
"port": "/dev/ttyUSB0"
}

5
.vscode/settings.json vendored Normal file
View File

@@ -0,0 +1,5 @@
{
"files.associations": {
"sstream": "cpp"
}
}

View File

@@ -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);
}