Skip to content

💡 A simple ESP8266 access-point–hosted web server that lets you toggle the onboard LED through a clean HTML interface.

License

Notifications You must be signed in to change notification settings

ashkanfeyzollahi/toggle-led

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

ESP8266 LED Toggle AP

💡 A simple ESP8266 access-point–hosted web server that lets you toggle the onboard LED through a clean HTML interface.
GitHub License

ESP8266 LED Toggle AP is a lightweight project that turns an ESP8266 into a standalone Wi-Fi Access Point hosting a minimal web interface.
With a single button on a webpage, users connected to the device can remotely toggle the built-in LED — no external Wi-Fi network required.

Built using PlatformIO, Arduino framework, and the ESP8266WebServer library, this project is ideal for beginners learning about microcontroller networking or for quick prototyping of Wi-Fi–controlled modules.


Features

  • Creates a self-contained Wi-Fi Access Point (ESP8266 / password 12345678)
  • Built-in HTTP server on port 80
  • Clean, responsive HTML interface with a big “Toggle LED” button
  • LED state switching handled server-side
  • Serial logs for debugging
  • PlatformIO-friendly structure
  • Works out-of-the-box with any ESP8266 board

Wi-Fi Access Point Info

SSID: ESP8266
Password: 12345678

After powering the ESP8266, connect to this network and navigate to:

http://192.168.4.1/

(Or whichever IP is printed on Serial Monitor.)


Controls (Web UI)

  • Toggle LED button – Switches LED_BUILTIN between ON/OFF
  • Automatic refresh (same page reloads)

Running the Project

Requirements

  • VSCode
  • PlatformIO extension
  • ESP8266 board (e.g., NodeMCU, Wemos D1 mini)

Steps to Run

  1. Clone the repository:
git clone https://github.com/ashkanfeyzollahi/toggle-led
  1. Navigate to the project folder:
cd toggle-led
  1. Open the folder in VSCode.

  2. PlatformIO will automatically detect the project. Make sure your board is connected.

  3. Build and upload:

pio run --target upload

Or press the â–ş Upload button in the PlatformIO sidebar.

  1. Open the Serial Monitor:
pio device monitor

You should see output indicating:

  • AP mode enabled
  • AP IP address
  • Web server started

How It Works (Technical Breakdown)

  • Initializes Serial, prints diagnostics.
  • Sets the ESP8266 to WIFI_AP mode.
  • Creates a Wi-Fi network using WiFi.softAP().
  • Starts the ESP8266WebServer instance on port 80.
  • Serves a minimal HTML page containing a full-screen button.
  • /toggle route flips the LED state using:
digitalWrite(LED_BUILTIN, digitalRead(LED_BUILTIN) == LOW ? HIGH : LOW);
  • Serial logs print LED toggle events.

Acknowledgements

Thanks to:

  • PlatformIO for a clean and modular ESP project structure
  • ESP8266 Arduino Core for the HTTP server and AP features
  • VSCode for easily managing embedded workflows

Bug Reports

Found an issue or have a suggestion? Open an issue on GitHub.

About

💡 A simple ESP8266 access-point–hosted web server that lets you toggle the onboard LED through a clean HTML interface.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages