Skip to content

Instantly share code, notes, and snippets.

@ahmethakanbesel
Last active April 9, 2020 18:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save ahmethakanbesel/29160f355e3d7415baf007aaf6ca44ab to your computer and use it in GitHub Desktop.
Save ahmethakanbesel/29160f355e3d7415baf007aaf6ca44ab to your computer and use it in GitHub Desktop.
#include <ESP8266WiFi.h>
#include <ESP8266HTTPClient.h>
const char* ssid = "";
const char* password = "";
const String url = "http://api.ipify.org";
void setup() {
Serial.begin(115200);
Serial.println("");
Serial.print("Bağlanılıyor ");
Serial.print(ssid);
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi bağlantısı kuruldu.");
Serial.println("Yerel IP adresi: ");
Serial.print(WiFi.localIP());
Serial.println("");
}
void loop() {
if (WiFi.status() == WL_CONNECTED) {
HTTPClient http;
http.begin(url);
int httpCode = http.GET();
if (httpCode > 0) {
String payload = http.getString();
Serial.println("Sayfa yanıtı:");
Serial.println(payload);
}
http.end();
}
delay(30000); // 30 saniyede bir işlemi tekrarlayacak
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment