From 8975eb785bc44b8446505298dd8ac9c887dc04d7 Mon Sep 17 00:00:00 2001 From: JonatanRek Date: Wed, 27 Nov 2019 18:18:46 +0100 Subject: [PATCH] FW tweeks --- .../ESP_OS_NODE_V3.ino.ino | 23 ++++++++++++------- 1 file changed, 15 insertions(+), 8 deletions(-) rename _FIRMWARE/firmwares/NodeMCU Sensor/{ => ESP_OS_NODE_V3.ino}/ESP_OS_NODE_V3.ino.ino (83%) diff --git a/_FIRMWARE/firmwares/NodeMCU Sensor/ESP_OS_NODE_V3.ino.ino b/_FIRMWARE/firmwares/NodeMCU Sensor/ESP_OS_NODE_V3.ino/ESP_OS_NODE_V3.ino.ino similarity index 83% rename from _FIRMWARE/firmwares/NodeMCU Sensor/ESP_OS_NODE_V3.ino.ino rename to _FIRMWARE/firmwares/NodeMCU Sensor/ESP_OS_NODE_V3.ino/ESP_OS_NODE_V3.ino.ino index 6f51b3c..02e6968 100644 --- a/_FIRMWARE/firmwares/NodeMCU Sensor/ESP_OS_NODE_V3.ino.ino +++ b/_FIRMWARE/firmwares/NodeMCU Sensor/ESP_OS_NODE_V3.ino/ESP_OS_NODE_V3.ino.ino @@ -5,9 +5,9 @@ #include //Variables -const char* ssid = ""; -const char* pasw = ""; -const char* hwId = ""; +const char* ssid = "SteelAntsNET"; +const char* pasw = "tgr786hgtp3CZ"; +const char* hwId = "JOK3R"; const char* url = "http://dev.steelants.cz/vasek/home/api.php"; int unsuccessfulRounds = 0; @@ -31,6 +31,10 @@ void setup() { void loop() { WiFi.begin(ssid, pasw); checkConnection(); + Serial.print("IP address:\t"); + Serial.println(WiFi.localIP()); + Serial.print("MAC address:\t"); + Serial.println(WiFi.macAddress()); //HTTP CLIENT HTTPClient http; @@ -79,15 +83,18 @@ void loop() { if (state != "succes") { unsuccessfulRounds++; - Serial.println("UNSUCCESSFUL ROUND NUMBER " + unsuccessfulRounds + "FROM 5"); + Serial.println("UNSUCCESSFUL ROUND NUMBER " + String(unsuccessfulRounds) + "FROM 5"); } else if (state == "succes") { unsuccessfulRounds = 0; } //Set static ip - IPAddress addr; - if (addr.fromString(ipAddress)) { - IPAddress ip(addr); + IPAddress staticIpAddress; +IPAddress subnetIpAddress(192,168,0,1); +IPAddress gatewayIpAddress(255, 255, 255, 0); + + if (staticIpAddress.fromString(ipAddress)) { + WiFi.config(staticIpAddress, subnetIpAddress, gatewayIpAddress); Serial.print("IP address:\t"); Serial.println(WiFi.localIP()); } @@ -100,7 +107,7 @@ void loop() { if(unsuccessfulRounds == 5) { Serial.println("RESTARTING ESP"); - ESP.restart() + ESP.restart(); } Serial.println("GOING TO SLEEP FOR " + String(sleepTime));