web analytics
October 22, 2015

ESP8266 – Creating an access point

To create your own WiFi network and let other devices connect to it, switch the module into AP mode and use the setSoftAPParam function.

#include "ESP8266.h"
#include "Phoenard.h"

// Initialize the module over Serial2 at 115200 baud
ESP8266 wifi(Serial2, 115200);

void setup(void) {
  Serial.begin(9600);  // Initialize serial
  enableWiFi();        // Turn on module
  wifi.restart();      // Restart the module

  // Set to AP mode
  if (wifi.setOprToSoftAP()) {
    Serial.println("Soft AP mode: OK");
  } else {
    Serial.println("Soft AP mode: ERROR");

  // Setup the AP
  if (wifi.setSoftAPParam("MyNetworkSSID", "MyPassword")) {
    Serial.println("Soft AP setup successful");
  } else {
    Serial.println("Soft AP setup not successful");

  // Start using the module here

void loop() {