- Thu Feb 07, 2019 1:03 am
#80465
All things considered it would seem that DHCP on your switch isn't working effectively (does, for example, your portable or potentially PC get a legitimate IP and passage?) or something is turning out badly while your ESP is recovering and setting a door (and conceivably even a substantial IP-) address from the switch
electrical engineering.
You could attempt to clear your ESP with the goal that all is as new and glimmer a straightforward precedent customer that just acquires an IP address (and portal) from a switch and completes a basic GET-ask.
CODE: SELECT ALL
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
/WiFi parameters to be arranged
const char* ssid = "ID_Of_Router";/Case touchy
const char* secret word = "Pass_Of_Router";/Case delicate
const char* http_site = "http://jsonplaceholder.typicode.com/clients";
const int http_port = 80;
void setup(void) {
Serial.begin(9600);
Serial.print("Busy interfacing");
WiFi.begin(ssid, secret word);/Associate with WiFi
/while wifi not associated yet, print '.'
/then after it associated, escape the circle
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
/Connected.
Serial.println("OK!");
/Passageway (SSID).
Serial.print("SSID: ");
Serial.println(WiFi.SSID());
/IP address.
Serial.print("IP: ");
Serial.println(WiFi.localIP());
/Signaalsterkte.
long rssi = WiFi.RSSI();
Serial.print("RSSI: ");
Serial.print(rssi);
Serial.println(" dBm");
Serial.println("");
}
void circle() {
if(WiFi.status()== WL_CONNECTED){/Check Wireless association status
HTTPClient HTTP;/Pronounce an object of class HTTPClient
http.begin("http://jsonplaceholder.typicode.com/clients/1");/Determine ask for goal
int httpCode = http.GET();/Send the demand
in the event that (httpCode > 0) {/Check the returning code
String payload = http.getString();/Get the demand reaction payload
Serial.println(payload);/Print the reaction payload
}
http.end();/Close association
} else {
Serial.println("Error in Wireless association");
}
delay(30000);/Send a demand at regular intervals
}