Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2020
90
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.20 KB | None | 0 0
  1. #include <Arduino.h>
  2. #include <ESP8266WiFi.h>
  3. #include <ESP8266mDNS.h>
  4. #include <WiFiUdp.h>
  5. #include <ArduinoOTA.h>
  6. #include <ESP8266WebServer.h>
  7.  
  8. ESP8266WebServer server(80);
  9.  
  10. #ifndef STASSID
  11. #define STASSID "OTALOL123"
  12. #define STAPSK ""
  13. #endif
  14.  
  15. IPAddress apIP(192, 168, 4, 1);
  16. const char* ssid = STASSID;
  17. const char* password = STAPSK;
  18.  
  19. void setup() {
  20. Serial.begin(115200);
  21. Serial.println("Booting");
  22.  
  23. Serial.print("MAC: ");
  24. Serial.println(WiFi.macAddress());
  25.  
  26. WiFi.mode(WIFI_AP);
  27. WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
  28. WiFi.softAP(ssid, password);
  29.  
  30. MDNS.begin("esp8266", WiFi.softAPIP());
  31. Serial.println("Ready");
  32. Serial.print("IP address: ");
  33. Serial.println(WiFi.softAPIP());
  34.  
  35. ArduinoOTA.begin();
  36. server.on("/",[](){
  37. delay(100);
  38. Serial.println("Hellogsddf!");
  39. server.send(200,"text/plain", "Hellogdfgd!!");
  40. });
  41. server.begin();
  42.  
  43. }
  44.  
  45. void loop() {
  46. ArduinoOTA.handle();
  47. server.handleClient();
  48. delay(50);
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement