Controlling an LED
First, we are going to see how to control a simple LED. The GPIO pins of the ESP8266 can be configured to realize many functions: inputs, outputs, PWM outputs, and also SPI or I2C communications. This first project will teach you how to use the GPIO pins of the chip as outputs:
- The first step is to add an LED to our project. These are the extra components you will need for this project:
- 5 mm LED (https://www.sparkfun.com/products/9590)
- 330 Ohm resistor to limit the current in the LED (https://www.sparkfun.com/products/8377)
- The next step is to connect the LED with the resistor to the ESP8266 board. To do so, the first thing to do is to place the resistor on the breadboard.
- Then, place the LED on the breadboard as well, connecting the longest pin of the LED (the anode) to one pin of the resistor.
- Then, connect the other end of the resistor to GPIO pin 5 of the ESP8266, and the other end of the LED to the ground.
This is what it should look like at the end:
- We are now going to...