Getting Started ESP8266

I already mentioned that I would be using Arduino to program these boards, Arduino is an open source hardware and software project that speeds up development on a range of Arduino compatible devices. Most of the hard work has been done already and provided in a wide range of libraries making this kind of embedded electronics accessible to almost anyone.

Download the integrated development environment (IDE) from the the Arduino website and install it on your machine. This package comes with information about a wide range of devices but we will need to add the ESP8266 specifically before we can create a project for these devices.

Once installed, open the program and go to File->Preferences.
Add the following URL in the Additional Boards Manager text box, this will tell the Arduino IDE how to find the files it needs to run the ESP devices. Click the OK button to accept the changes. http://arduino.esp8266.com/package_esp8266com_index.json


Now we need to add ESP devices to the list of available boards, go to Tools->Board:Arduino->Boards Manager. It'll be the top entry at the list of devices.


Use the search bar at the top to find the ESP library, as you type it'll narrow the selection down. Once you have selected ESP8266 a box will appear that allows you to install a version of the library. Select the most recent version and click "install". A progress bar will update while the libraries are installing.

Now when you go back into the board selection (Tools->Board:...) you will see a new section and several new entries for ESP8266 devices.
Select "WeMos D1 R2 & mini" from the list, this will set up the compiler to target the board you're going to be using.


Connect the device to your computer using a USB cable and allow the PC to establish a serial connection with the device.
Go to Tools->Ports to select the newly established Com port from the list of available com ports.
Now your ready to test the device.


Here is some simple Blink code, you can see that in the setup function the device sets up the LED pin to be an output and in the main loop it toggles the value between high and low once a second to make the LED flash.


Click the Upload button (arrow pointing right) to send the code to the device, if all is successful you should now have a flashing LED on the device.