Control the LED connected to the ESP8266 webserver. Initially create a simple web server and connect an LED to ESP8266. Now, the user can open the webserver and control the LED by toggling the buttons. In this, we have only used LED, but you can also connect various different sensors. However, there are only two GPIO pins on ESP8266-01 so only one sensor can be connected to ESP8266 at a time. Anyways, Let’s start.
Step 1: Required Components
Step 2: Circuit Time
- Connect CH_PD and Vcc to +3.3v pin of LD1117.
- Connect GND pin to digital ground. (you can use a common ground for both ESP8266 and LD1117).
- Connect the Anode of LED to GPIO0 0 with resistor in-between GPIO and Anode.
- Connect Cathode to Ground.
- Provide power supply to LD1117.
Step 3: Code Time
In the code, the server interprets requests by the browser. Buttons used in the webpage are used to set the status of LED to on or off.
Step 4: Upload code to ESP8266
Simply upload the code using the procedure mentioned below-given link. After successfully uploading the code, remove TX and RX pins.
Learn more about uploading code to ESP8266.