Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <ESP8266WiFi.h>
- // #include "DHT.h"
- const char* ssid ="Panda"; // Tu wpisz nazwę swojego wifi
- const char* password = "TurlanieSpanieJedzenie2137"; // Tu wpisz hasło do swojego wifi
- WiFiServer server(80);
- void setup() {
- Serial.begin(115200);
- delay(10);
- // Connect to WiFi network
- Serial.println();
- Serial.println();
- Serial.print("Connecting to ");
- Serial.println(ssid);
- WiFi.begin(ssid, password);
- while (WiFi.status() != WL_CONNECTED) {
- delay(500);
- Serial.print(".");
- }
- Serial.println("");
- Serial.println("WiFi connected");
- // Start the server
- server.begin();
- Serial.println("Server started");
- // Print the IP address
- Serial.print("Use this URL to connect: ");
- Serial.print("http://");
- Serial.print(WiFi.localIP());
- Serial.println("/");
- }
- void loop() {
- // Check if a client has connected
- WiFiClient client = server.available();
- if (!client) {
- return;
- }
- // Wait until the client sends some data
- Serial.println("new client");
- int timewate = 0;
- while(!client.available()){
- delay(1);
- timewate = timewate +1;
- if(timewate>1800)
- {
- Serial.println(">>> Client Timeout !");
- client.stop();
- return;
- }
- }
- // Read the first line of the request
- String request = client.readStringUntil('\r');
- Serial.println(request);
- client.flush();
- // Return the response
- client.println("HTTP/1.1 200 OK");
- client.println("Content-Type: text/html");
- client.println(""); // do not forget this one
- client.println("");
- client.println("");
- client.print("Agatka maslo kupa");
- client.println("");
- client.println("");
- client.println("");
- client.println("");
- client.println("");
- client.println("");
- delay(1);
- Serial.println("Client disonnected");
- Serial.println("");
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement