Skip to content

Instantly share code, notes, and snippets.

@futechiot
Last active October 22, 2019 06:58
Show Gist options
  • Save futechiot/98d5560127c05d81ced4b3ead828238b to your computer and use it in GitHub Desktop.
Save futechiot/98d5560127c05d81ced4b3ead828238b to your computer and use it in GitHub Desktop.
ESP8266 in AccessPoint(Hotspot) mode : Create Hotspot on ESP8266 device for Connection purpose, to give Wifi Credential, to host WebServer, To host Webpage and Give Command
/*
OUTPUT: Creating your own hotspot on esp8266 wifi module.
Author: Ankit Rana (Futechiot)
Board Used: Wemos d1 mini, Wemos d1 mini pro, Node MCU
Website: www.futechiot.com
GitHub: https://github.com/futechiot
*/
#include <ESP8266WiFi.h> //Wifi library of esp8266 to access HARDWARRE APIS and othe functionality
/* Set these to your desired credentials. */
const char *Apssid = "Anything you like"; //Give AccessPoint name whatever you like. (Name of your esp8266 HOTSPOT)
const char *Appassword = "1234567890"; //Password of your esp8266's hotspot,(minimum length 8 required)
void setup() {
// put your setup code here, to run once:
Serial.begin(115200); // To enable Serial Commmunication with connected esp8266 board
Serial.println();
Serial.println("Configuring access point...");
WiFi.mode(WIFI_AP); // Changing ESP8266 wifi mode to AccessPoint
// You can remove the Appassword parameter if you want the hotspot to be open.
WiFi.softAP(Apssid, Appassword); //Starting AccessPoint on given credential
IPAddress myIP = WiFi.softAPIP(); //IP Address of our Esp8266 accesspoint(where we can host webpages, and see data)
Serial.print("AP IP address: ");
Serial.println(myIP); //Default IP is 192.168.4.1
Serial.println("Scan For Wifi in your Mobile or laptop, you will see this network");
}
void loop() {
// put your main code here, to run repeatedly:
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment