Firmware impruevement #2
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
//Includes
|
||||
#include <DHT.h>
|
||||
#include <ESP8266WiFi.h>
|
||||
#include <ESP8266HTTPClient.h>
|
||||
@@ -73,6 +74,7 @@ void loop() {
|
||||
//configuration setup
|
||||
String hostName = doc["device"]["hostname"];
|
||||
int sleepTime = doc["device"]["sleepTime"];
|
||||
String ipAddress = doc["device"]["ipAddress"];
|
||||
String state = doc["state"];
|
||||
|
||||
if (state != "succes") {
|
||||
@@ -82,6 +84,14 @@ void loop() {
|
||||
unsuccessfulRounds = 0;
|
||||
}
|
||||
|
||||
//Set static ip
|
||||
IPAddress addr;
|
||||
if (addr.fromString(ipAddress)) {
|
||||
IPAddress ip(addr);
|
||||
Serial.print("IP address:\t");
|
||||
Serial.println(WiFi.localIP());
|
||||
}
|
||||
|
||||
WiFi.hostname(hostName);
|
||||
|
||||
http.end(); //Close connection
|
||||
|
Reference in New Issue
Block a user