💡 A simple ESP8266 access-point–hosted web server that lets you toggle the onboard LED through a clean HTML interface.
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.
- Creates a self-contained Wi-Fi Access Point (
ESP8266/ password12345678) - 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
SSID: ESP8266
Password: 12345678
After powering the ESP8266, connect to this network and navigate to:
(Or whichever IP is printed on Serial Monitor.)
- Toggle LED button – Switches
LED_BUILTINbetween ON/OFF - Automatic refresh (same page reloads)
- VSCode
- PlatformIO extension
- ESP8266 board (e.g., NodeMCU, Wemos D1 mini)
- Clone the repository:
git clone https://github.com/ashkanfeyzollahi/toggle-led- Navigate to the project folder:
cd toggle-led-
Open the folder in VSCode.
-
PlatformIO will automatically detect the project. Make sure your board is connected.
-
Build and upload:
pio run --target uploadOr press the â–ş Upload button in the PlatformIO sidebar.
- Open the Serial Monitor:
pio device monitorYou should see output indicating:
- AP mode enabled
- AP IP address
- Web server started
- Initializes Serial, prints diagnostics.
- Sets the ESP8266 to WIFI_AP mode.
- Creates a Wi-Fi network using
WiFi.softAP(). - Starts the
ESP8266WebServerinstance on port 80. - Serves a minimal HTML page containing a full-screen button.
/toggleroute flips the LED state using:
digitalWrite(LED_BUILTIN, digitalRead(LED_BUILTIN) == LOW ? HIGH : LOW);- Serial logs print LED toggle events.
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
Found an issue or have a suggestion? Open an issue on GitHub.