Skip to content

Instantly share code, notes, and snippets.

@aliustaoglu
Last active December 18, 2017 10:05
Show Gist options
  • Save aliustaoglu/aa7bdfc8e102095e273a52323ebd711d to your computer and use it in GitHub Desktop.
Save aliustaoglu/aa7bdfc8e102095e273a52323ebd711d to your computer and use it in GitHub Desktop.
#include <ESP8266WebServer.h>
#include "SSD1306.h"
const char* ssid = "AGADI";
const char* password = "AGSIFRESI";
ESP8266WebServer server(80);
SSD1306 display(0x3c, 5, 4);
void ana_sayfa() {
Serial.print("Ana sayfa");
String mesaj = server.arg("mesaj");
mesajYaz(mesaj);
server.send(200, "text/html", mesaj);
delay(100);
}
void setup () {
Serial.begin(115200);
display.init();
display.flipScreenVertically();
mesajYaz("Merhaba Dunya");
WiFi.begin(ssid, password);
while (WiFi.status() != WL_CONNECTED) {
delay(1000);
Serial.print("Bağlanıyor..");
}
Serial.print("Bağlandı ");
Serial.print("IP adresi: ");
Serial.print(WiFi.localIP());
server.on("/", ana_sayfa);
server.begin();
Serial.println("HTTP başlatıldı");
}
void loop() {
server.handleClient();
delay(5000);
}
void mesajYaz(String message)
{
display.clear();
display.setTextAlignment(TEXT_ALIGN_LEFT);
display.setFont(ArialMT_Plain_10);
display.drawString(0, 0, message);
display.setFont(ArialMT_Plain_16);
display.drawString(0, 10, message);
display.setFont(ArialMT_Plain_24);
display.drawString(0, 26, message);
display.display();
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment