Using the new Arduino IDE for ESP8266 and found bugs, report them here

Moderator: igrr

User avatar
By SwiCago
#19491 I wrote a simple sketch to connect to my wifi router as a client. When the esp01 is running the sketch, it connects to my wifi fine and is accessible via the IP given, but it also creates it's own unsecured network. The unsecured network allows anyone to connect and load the page and control the chip(if extra handling is included).

Please see details below and let me know if I need to add something to make it only run as a wifi client and not also an AP!

Thanks in advance
-AL

Details: Arduino IDE 1.6.4
Generic ESP8266 Module 1.6.4-673-g8cd3697
Installed via instructions found on viewtopic.php?f=26&t=3094

Sample sketch the connects to an access point as client and also creates its own AP
Code: Select all#include <ESP8266WiFi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>

const char* ssid     = "MY_ROUTER";
const char* password = "MY_PASSWD";

const String html = "<html><head></head><body>Hello World</body></html>";

ESP8266WebServer server(80);

void setup() {
  Serial.begin(115200);
  WiFi.begin(ssid, password);
  Serial.print("\n\r \n\rWorking to connect");
  while (WiFi.status() != WL_CONNECTED) {
    delay(500);
    Serial.print(".");
  }
  Serial.println("");
  Serial.print("Connected to ");
  Serial.println(ssid);
  Serial.print("IP address: ");
  Serial.println(WiFi.localIP());
  server.on("/", handle_root);
  server.begin();
  Serial.println("HTTP server started");
}

void loop() {
  server.handleClient();
}

void handle_root() {
  Serial.println("Root page called");
  server.send(200, "text/html", html);
  delay(100);
}