Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266WiFi.h>
- #include <ESP8266HTTPClient.h>
- const char *ssid = "DataJugling";
- const char *password = "jugle123";
- const char *url = "http://dataserver.local/";
- void setup() {
- Serial.begin(115200);
- pinMode(LED_BUILTIN, OUTPUT);
- digitalWrite(LED_BUILTIN, LOW);
- WiFi.mode(WIFI_STA);
- WiFi.begin(ssid, password);
- while (WiFi.status() != WL_CONNECTED) delay(500);
- digitalWrite(LED_BUILTIN, HIGH);
- }
- void loop() {
- HTTPClient http;
- http.begin(url);
- int httpCode = http.GET();
- if (httpCode > 0) {
- String data = http.getString();
- Serial.println(data);
- } else {
- Serial.printf("[HTTP] Error: %s\n", http.errorToString(httpCode).c_str());
- }
- http.end();
- delay(1000);
- }
Add Comment
Please, Sign In to add comment