daily pastebin goal
70%
SHARE
TWEET

ESP8266 STAN

a guest Apr 4th, 2015 2,520 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <ESP8266WiFi.h>
  2. #include <WiFiClient.h>
  3. #include <ESP8266WebServer.h>
  4.  
  5. const char* ssid = "...............";
  6. const char* password = "...............";
  7.  
  8.  
  9. ESP8266WebServer server(80);
  10.  
  11.  
  12.  
  13.  
  14.  
  15. void setup(void)
  16. {
  17.   pinMode(2, OUTPUT);
  18.  
  19.   // Connect to WiFi network
  20.   WiFi.begin(ssid, password);
  21.  
  22.   // Wait for connection
  23.   while (WiFi.status() != WL_CONNECTED) {
  24.     delay(500);
  25.   }
  26.    
  27.   server.on("/", [](){
  28.       server.send(200, "Wejdz na mojeip/wlacz by wlaczyc stan wysoki na pinie 2!!");
  29.   });
  30.  
  31.   server.on("/wlacz", [](){
  32.     server.send(200, "text/plain", "Mamy stan wysoki!");
  33.     digitalWrite(2,HIGH);
  34.     delay(1000);
  35.     digitalWrite(2,LOW);
  36.   });
  37.  
  38.   server.begin();
  39. }
  40.  
  41. void loop(void)
  42. {
  43.   server.handleClient();
  44. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top