Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <Arduino.h>
- #include <ESP8266WiFi.h>
- #include <ESP8266mDNS.h>
- #include <WiFiUdp.h>
- #include <ArduinoOTA.h>
- #include <ESP8266WebServer.h>
- ESP8266WebServer server(80);
- #ifndef STASSID
- #define STASSID "OTALOL123"
- #define STAPSK ""
- #endif
- IPAddress apIP(192, 168, 4, 1);
- const char* ssid = STASSID;
- const char* password = STAPSK;
- void setup() {
- Serial.begin(115200);
- Serial.println("Booting");
- Serial.print("MAC: ");
- Serial.println(WiFi.macAddress());
- WiFi.mode(WIFI_AP);
- WiFi.softAPConfig(apIP, apIP, IPAddress(255, 255, 255, 0));
- WiFi.softAP(ssid, password);
- MDNS.begin("esp8266", WiFi.softAPIP());
- Serial.println("Ready");
- Serial.print("IP address: ");
- Serial.println(WiFi.softAPIP());
- ArduinoOTA.begin();
- server.on("/",[](){
- delay(100);
- Serial.println("Hellogsddf!");
- server.send(200,"text/plain", "Hellogdfgd!!");
- });
- server.begin();
- }
- void loop() {
- ArduinoOTA.handle();
- server.handleClient();
- delay(50);
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement