Advertisement
Victoryus82

Wemos_wifiAP_teszt

May 13th, 2019
161
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 1.07 KB | None | 0 0
  1. #include <ESP8266WiFi.h>
  2. #include <WiFiClient.h>
  3. #include <ESP8266WebServer.h>
  4.  
  5. // config:
  6.  
  7. const char *ssid = "ESPWifiTeszt";  // You will connect your phone to this Access Point
  8. const char *pw = "nincs"; // and this is the password
  9. IPAddress ip(192, 168, 1, 10); // From RoboRemo app, connect to this IP
  10. IPAddress netmask(255, 255, 255, 0);
  11. const int port = 4000; // and this port
  12. ESP8266WebServer server(80);
  13.  
  14.  
  15. WiFiClient client;
  16.  
  17. void handleRoot() {
  18.   server.send(200, "text/html", "<h1>You are connected</h1>");
  19. }
  20.  
  21. void setup() {
  22.   Serial.begin(115200);
  23.  
  24.   WiFi.softAPConfig(ip, ip, netmask); // configure ip address for softAP
  25.   WiFi.softAP(ssid, pw); // configure ssid and password for softAP
  26.  
  27.   Serial.println("ESP8266 RC receiver 1.1 powered by RoboRemo");
  28.   Serial.println((String)"SSID: " + ssid + "  PASS: " + pw);
  29.   Serial.println((String)"RoboRemo app must connect to " + ip.toString() + ":" + port);
  30.  
  31.   server.on("/", handleRoot);
  32.   server.begin();
  33.   Serial.println("HTTP server started");
  34.  
  35. }
  36.  
  37.  
  38. void loop() {  
  39.    server.handleClient();
  40. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement