SHARE
TWEET

Untitled

a guest Oct 12th, 2017 54 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include<ESP8266WiFi>
  2.  
  3. const char* ssid = "localhost";
  4. const char* password = ";  
  5.  
  6. WiFiServer server(80);
  7.  
  8. void setup() {
  9.  Serial.begin(115200);
  10.  delay(10);  
  11.  Serial.println();
  12.  Serial.println();
  13.  Serial.print("Laczenie");
  14.  Serial.println(ssid);
  15.  WiFi.begin(ssid, password);
  16.  while (WiFi.status() != WL_CONNECTED) {
  17.    delay(500);
  18.    Serial.print(".");
  19.  }
  20.  Serial.println("");
  21.  Serial.println("Polaczono z WiFi");
  22.  server.begin();
  23.  Serial.print("URL strony: ");
  24.  Serial.print("http://");
  25.   Serial.print(WiFi.localIP());
  26.   Serial.println("/");
  27. }
  28.  
  29. void loop() {
  30.   WiFiClient client = server.available();
  31.   if (!client) {
  32.     return;
  33.   }
  34.   Serial.println("nowy klient");
  35.   while(!client.available()){
  36.     delay(1);
  37.   }
  38.   client.flush();
  39.   client.println("HTTP/1.1 200 OK");
  40.   client.println("Content-Type: text/html");
  41.   client.println("");
  42.   client.println("");
  43.   client.println("");
  44.   client.print("Polaczenie jest ok ");
  45.   Serial.println("Rozlaczono z serwerem");
  46.   Serial.println("");
  47.   }
RAW Paste Data
Top