Skip to content

Instantly share code, notes, and snippets.

@42Bots
Last active May 2, 2017 04:18
Show Gist options
  • Save 42Bots/3540927fd28d9c7020b38779eb02895f to your computer and use it in GitHub Desktop.
Save 42Bots/3540927fd28d9c7020b38779eb02895f to your computer and use it in GitHub Desktop.
ESP8266 Soft Access Point Example
/*
* For more information see http://42bots.com
* Configure the ESP8266 unit as a Wi-Fi access point
*/
#include <ESP8266WiFi.h>
/* Your WiFi Soft Access Point settings */
const char* ssid = "ESP8266"; //this will be the network name
const char* password = "ESP8266Test"; //this will be the network password
void setup() {
delay(1000);
Serial.begin(115200);
Serial.println();
Serial.println();
Serial.print("Configuring WiFi access point...");
/* You can remove the password parameter if you want the AP to be open. */
boolean result = WiFi.softAP(ssid, password);
if(result==true) {
IPAddress myIP = WiFi.softAPIP();
Serial.println("done!");
Serial.println("");
Serial.print("WiFi network name: ");
Serial.println(ssid);
Serial.print("WiFi network password: ");
Serial.println(password);
Serial.print("Host IP Address: ");
Serial.println(myIP);
Serial.println("");
}
else {
Serial.println("error! Something went wrong...");
}
}
void loop() {
Serial.printf("Number of connected devices (stations) = %d\n", WiFi.softAPgetStationNum());
delay(3000);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment