Compare commits
3 Commits
master
...
4a4ddc1d28
| Author | SHA1 | Date | |
|---|---|---|---|
| 4a4ddc1d28 | |||
| 9a64876f07 | |||
| 883da0d422 |
3
.vscode/arduino.json
vendored
3
.vscode/arduino.json
vendored
@@ -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
5
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,5 @@
|
||||
{
|
||||
"files.associations": {
|
||||
"sstream": "cpp"
|
||||
}
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user