I want to turn my ESP8266 into an access point so that I can connect directly to it.

I use the following sketch, but when I select GENERIC module ESP8266 from menu, the libraries ESP8266WiFi.h and ESP8266WebServer.h become available but I was unable to upload the sketch.

Also when I select board as Arduino Uno (Which i have really) and then what to upload then the above two files becomes unavailable and says fatal error no such file... no idea what to do next.

#include <ESP8266wifi.h>
#include <WiFiClient.h>
#include <ESP8266WebServer.h>
SoftwareSerial esp(2,3);
IPAddress local_IP(192,168,4,22);
IPAddress gateway(192,168,4,9);
IPAddress subnet(255,255,255,0);
 String ssid="Wisal";
 String pass="12345678";
 ESP8266WebServer server(80);
 boolean isAccessPointCreated=false;
void setup(){
  Serial.print("Setting soft-AP configuration ... ");
  Serial.println(WiFi.softAPConfig(local_IP, gateway, subnet) ? "Ready" : "Failed!");

  Serial.print("Setting soft-AP ... ");
  Serial.println(WiFi.softAP("ESPsoftAP_01") ? "Ready" : "Failed!");
  Serial.print("Soft-AP IP address = ");

void loop(){
    char a = esp.read();
      if(a == '\0')
      if(a != '\r' && a != '\n' && (a < 32))
  • 1
    Are you trying upload to an Uno or an ESP8266? The hardware package and libraries you're referring to are for use directly on an ESP8266, not an Uno using an ESP8266 for WiFi communications.
    – per1234
    Feb 25, 2017 at 17:38
  • i upload the sketch to arduino uno and the esp8266 is connected to my arduino uno.
    – Wisal
    Feb 25, 2017 at 18:06

3 Answers 3


The ESP8266 core for Arduino that you're trying to use is for programming ESP8266 directly. You are trying to program an Uno with an ESP8266 connected to it for use as a WiFi module. For that application the ESP8266 core is of no use. For your application it's most common to run the AT firmware on the ESP8266 and communicate via serial. If you're doing that I recommend the WiFiEsp library:


Since you're uploading to the Uno you should have Arduino/Genuino Uno selected in the Tools > Board menu.


There are two ways to use an ESP8266.

Method 1

You seem to say you are using it as a slave to your UNO. You program you Uno from the IDE. The program will have code in it to send 'AT' commands to the ESP and this will make the ESP handle all the WIFI stuff.

Method 2

You remove you Uno and use the ESP as the main processor. This means you get to program the ESP with C++ like code through the IDE, just as if it was an UNO. HOWEVER you will need to install the ESP package from the board manager and there are certain limitations. You also have access to less IO ports, but you can connect the Uno (over serial or I2C) and use it as a slave (which you program through the IDE separately).


You have imported ESP8266wifi.h and not ESP8266WiFi.h

Not the answer you're looking for? Browse other questions tagged or ask your own question.