Introdution to the Arduino IDE For a ESP8266 Board on the Raspberry Pi
In a previous post, we showed how to install the Arduino IDE on the Raspberry Pi. Here we will show how to work with the Arduino IDE using a ESP8266 based board.
The ESP8266 board I selected to use is the WeMos D1 R2 & mini which you can purchase from Banggood. I also bought a micro USB port line to connect the WeMos D1 R2 mini to the Raspberry Pi. Connect the WeMos to one of the Raspberry Pi’s USB ports before turning the Raspberry Pi on.
Configuring the Arduino IDE
Here is how to install the board managers for ESP8266 boards.
Launch the Arduino IDE, click on the Arduino menu at the upper left, and select Preferences. The following appears:
For the field, Additional Boards Manager URLs: enter http://arduino.esp8266.com/stable/package_esp8266com_index.json
and click ok.
Go to the Tools menu and seclect Boards Manager. Scroll down to the esp8266 as shown below and click on install.
Now under the Tools––Board menu you can select the WeMos D1 R2 & mini board, which we will use.
You may need to tell the Arduino IDE the port on the Raspberry Pi that it is connected to. Under the Tools––Port menu, select /dev/tty/USBo
Running the Blink Sketch
Use the File menu to select the Examples — 01.Basics––Blink sketch. The D4 pin on the WeMos controls the blinking of its LED. In lines, 27, 32, and 35 change the variable LED_BUILTIN to D4. I then saved this sketch, and named it BlinkMini.
Verify and compile the BlinkMini sketch by selecting Sketch Menu––Verify/Compile.
Upload the sketch to the WeMos D1 R2 minu by selecting Sketch Menu––Upload.
The blue LED on the WeMos should now be blinking.