Controlling an LED
This recipe is going to look at how to control an LED using an ESP8266 board. This will basically involve changing the state of an LED either ON or OFF, using the ESP8266 board's GPIO pins. The exercise will enable you to understand how to use the digital output function on the ESP8266.
Getting ready
Connect your ESP8266 board to your computer via a USB cable and set up your Arduino IDE (refer back to Chapter 1, Configuring the ESP8266). Once that is done, you can proceed to make the other connections.
In this recipe, we will need the following components:
- ESP8266 board
- USB cable
- LED (https://www.sparkfun.com/products/528)
- 220 Ω resistor (https://www.sparkfun.com/products/10969)
- Breadboard
- Jumper wires
Start by mounting the LED onto the breadboard. Connect one end of the 220 Ω resistor to the positive leg of the LED (the positive leg of an LED is usually the taller one of the two legs). Connect the other end of the resistor to another rail of the breadboard and...