Installing the ESP8266 Board in Arduino IDE
To use the ESP8266 with the Arduino IDE, you’ll need to install the ESP8266 board in the IDE. Follow the steps explained to install ESP8266 in Arduino IDE:
Step 1: Open the Arduino IDE
First, open the Arduino IDE on your computer.
Step 2: Go to Arduino Preferences
Next, click on the “File” menu and select “Preferences” from the drop-down menu or press “CTRL+ Comma”. This will open the Preferences window.
Step 3: Enter the ESP8266 Board Manager URL
In the Preferences window, look for the “Additional Boards Manager URLs” field. In this field, enter the following URL:
Note: If you already have the ESP32 boards URLs, separate them with commas as follows:
Once you’ve entered the URL, click the “OK” button to save the changes.
Step 4: Open the Boards Manager
Now, go to the “Tools” menu and select “Boards” from the drop-down menu. Then, select “Boards Manager” from the sub-menu.
Step 5: Install the ESP8266 Board
Now search for “esp8266”. You should see an entry for “esp8266 by ESP8266 Community”. Click on this entry, then click “Install” to begin the ESP8266 installation in Arduino IDE.
Step 6: Select the ESP8266 Board
After completing the installation process, go to “Tools” and select “Board”. Then, select whichever board you are going to use.
How to Program ESP8266 Using Arduino IDE
To program ESP8266 using Arduino IDE, the USB to Serial drivers must be installed in our system. Most of the time ESP8266 comes with CP2102 or CH340 serial driver chips. Both have separate drivers that must be installed in order to establish serial communication between ESP8266 and Arduino IDE.
Detailed instructions for installing these drivers can be found here:
Troubleshooting
If you try to upload a new sketch to your ESP8266 and you get this error message “esptool.FatalError: Failed to connect to ESP8266: Timed out waiting for packet header“. It means that your ESP8266 is not in flashing/uploading mode.
Having the right board name and COM port selected, follow these steps:
- Hold-down the “BOOT/FLASH” button in your ESP8266 development board
- Press the “Upload” button in the Arduino IDE to upload your sketch:
- When you see the “Connecting….” message in your Arduino IDE, release the finger from the “BOOT/FLASH” button
- After that, you should see the “Done uploading” message
Your ESP8266 should have the new sketch running. Press the “ENABLE/RESET” button to restart the ESP8266 and run the new uploaded sketch.
Uploading the Sketch
Uploading the Sketch to the ESP-12E
If you’re using an ESP-12E NodeMCU Kit, uploading the sketch is very simple, since it has built-in programmer. Plug your board to your computer. Make sure you have the right board selected:
You also need to select the Port:
Then, copy the code provided:
/********* Rui Santos Complete project details at https://randomnerdtutorials.com *********/ int pin = 2; void setup() { // initialize GPIO 2 as an output. pinMode(pin, OUTPUT); } // the loop function runs over and over again forever void loop() { digitalWrite(pin, HIGH); // turn the LED on (HIGH is the voltage level) delay(1000); // wait for a second digitalWrite(pin, LOW); // turn the LED off by making the voltage LOW delay(1000); // wait for a second }
Click the “Upload” button in the Arduino IDE and wait a few seconds until you see the message “Done uploading.” in the bottom left corner.
Uploading the Sketch to the ESP-01
Uploading code to the ESP-01 requires establishing a serial communication between your ESP8266 and a FTDI Programmer as shown in the schematic diagram below.
The following table shows the connections you need to make between the ESP8266 and the FTDI programmer.
ESP8266 | FTDI programmer |
RX | TX |
TX | RX |
CH_PD | 3.3V |
GPIO 0 | GND |
VCC | 3.3V |
GND | GND |
If you have a brand new FTDI Programmer and you need to install your FTDI drivers on Windows PC, visit this website for the official drivers: http://www.ftdichip.com/Drivers/VCP.htm.
Then, you just need to connect the FTDI programmer to your computer, and upload the sketch to your ESP8266 board. You should see the “Done Uploading” message after a few seconds.
Understanding ESP8266
The ESP8266 is a Wi-Fi module that can connect and exchange data with other devices inside a wireless network. It’s based on the ESP8266EX chip, which is a low-cost, low-power SoC (System on Chip) that combines a microcontroller, Wi-Fi radio, and memory.
To program ESP8266, we can use different languages and compilers including the Arduino IDE. The ESP8266 can also be used with other microcontrollers, such as the Arduino using which we can add Wi-Fi communication in different Arduino-based projects.
Prerequisites: Arduino IDE Installed
Before starting this installation procedure, make sure you have the latest version of the Arduino IDE installed in your computer. If you don’t, uninstall it and install it again. Otherwise, it may not work.
Having the latest Arduino IDE software installed from arduino.cc/en/Main/Software, continue with this tutorial.
Do you need an ESP8266 board? You can buy it here.
Using git version¶
This is the suggested installation method for contributors and library developers.
Prerequisites¶
-
Internet connection
-
Arduino IDE 1.x or 2.x (https://www.arduino.cc/en/software)
-
git (https://git-scm.com)
-
Python ≥3.7 (https://python.org)
-
terminal, console, or command prompt (depending on your OS)
-
Uninstalling any core version installed via Board Manager
Instructions – Windows 10¶
-
First, make sure you don’t already have an ESP8266 core version installed using the Board Manager (see above). If you do, uninstall it from the Board Manager before proceeding. It is also advisable to erase the Arduino15 contents.
-
Install git for Windows (if not already; see https://git-scm.com/download/win)
-
Open a command prompt (cmd) and go to Arduino default directory. This is typically the sketchbook directory (usually
C:\Users\{username}\Documents\Arduino
where the environment variable
%USERPROFILE%
usually contains
C:\Users\{username}
) -
Clone this repository into hardware/esp8266com/esp8266 directory.
cd %USERPROFILE%\Documents\Arduino\ if not exist hardware mkdir hardware cd hardware if not exist esp8266com mkdir esp8266com cd esp8266com git clone https://github.com/esp8266/Arduino.git esp8266
You should end up with the following directory structure in
C:\Users\{your username}\Documents\
Arduino | — libraries — hardware | — esp8266com | — esp8266 | — bootloaders — cores — doc — libraries — package — tests — tools — variants — platform.txt — programmers.txt — README.md — boards.txt — LICENSE
-
Initialize submodules to fetch external libraries
cd %USERPROFILE%\Documents\Arduino\hardware\esp8266com\esp8266 git submodule update –init
Not doing this step would cause build failure when attempting to include
SoftwareSerial.h
,
Ethernet.h
, etc. See our .gitmodules file for the full list.
-
Download binary tools
cd tools python3 get.py
-
Restart Arduino
-
If using the Arduino IDE for Visual Studio (https://www.visualmicro.com/), be sure to click Tools – Visual Micro – Rescan Toolchains and Libraries
-
When later updating your local library, goto the esp8266 directory and do a git pull
cd %USERPROFILE%\Documents\Arduino\hardware\esp8266com\esp8266 git status git pull
Note that you could, in theory install in
C:\Program Files (x86)\Arduino\hardware
however this has security implications, not to mention the directory often gets blown away when re-installing Arduino IDE. It does have the benefit (or drawback, depending on your perspective) – of being available to all users on your PC that use Arduino.
Instructions – Other OS¶
-
First, make sure you don’t already have an ESP8266 core version installed using the Board Manager (see above). If you do, uninstall it from the Board Manager before proceeding. It is also advisable to erase the .arduino15 (Linux) or Arduino15 (MacOS) contents.
-
Open the console and go to Arduino directory. This can be either your sketchbook directory (usually
/Arduino
), or the directory of Arduino application itself, the choice is up to you. -
Clone this repository into hardware/esp8266com/esp8266 directory. Alternatively, clone it elsewhere and create a symlink, if your OS supports them.
cd hardware mkdir esp8266com cd esp8266com git clone https://github.com/esp8266/Arduino.git esp8266
You should end up with the following directory structure:
Arduino | — hardware | — esp8266com | — esp8266 | — bootloaders — cores — doc — libraries — package — tests — tools — variants — platform.txt — programmers.txt — README.md — boards.txt — LICENSE
-
Initialize submodules to fetch external libraries
cd esp8266 git submodule update –init
Not doing this step would cause build failure when attempting to include
SoftwareSerial.h
,
Ethernet.h
, etc. See our .gitmodules file for the full list.
-
Download binary tools
cd tools python3 get.py
If you get an error message stating that python3 is not found, you will need to install it (most modern UNIX-like OSes provide Python 3 as part of the default install). To install you will need to use
sudo yum install python3
,
sudo apt install python3
, or
brew install python3
as appropriate. On the Mac you may get an error message like:python3 get.py Platform: x86_64-apple-darwin Downloading python3-macosx-placeholder.tar.gz Traceback (most recent call last): File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/urllib/request.py”, line 1317, in do_open encode_chunked=req.has_header(‘Transfer-encoding’)) … File “/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/ssl.py”, line 1117, in do_handshake self._sslobj.do_handshake() ssl.SSLCertVerificationError: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1056)This is because Homebrew on the Mac does not always install the required SSL certificates by default. Install them manually (adjust the Python 3.7 as needed) with:
cd “/Applications/Python 3.7/” && sudo “./Install Certificates.command”
-
Restart Arduino
-
When later updating your local library, goto the esp8266 directory and do a git pull
cd hardware\esp8266com\esp8266 git status git pull
Maintaining¶
To keep up with the development branch
git switch –recurse-submodules –discard-changes master git pull –recurse-submodules cd tools python3 get.py
Pull requests¶
To test not yet merged Pull Request, first you have to find its ID number. This is the sequence of digits right after the pull request title.
Open terminal and cd into the directory where the repository was previously cloned. For example, 12345 is the Pull Request ID
git fetch origin pull/12345/head git switch –detach –recurse-submodules –discard-changes FETCH_HEAD
When Pull Request updates packaged tools, make sure to also fetch their latest versions.
cd tools python3 get.py
To go back to using the development branch
git switch –recurse-submodules –discard-changes master git pull –recurse-submodules
Step 2: Installing the USB-to-Serial Bridge Driver
There are numerous ESP8266-based development boards available. Depending on the design, you may need to install additional drivers for your USB-to-serial converter before you are able to upload code to your ESP8266.
For example, the ESP8266 NodeMCU uses the CP2102 to convert USB signals to UART signals, whereas the WeMos D1 Mini uses the CH340G. The ESP-01, on the other hand, lacks an onboard USB-to-serial converter and requires a separate module.
Make sure to inspect your board carefully to identify the USB-to-serial converter that is present. You’ll probably have either CP2102 or CH340 populated on the board.
If you’ve never installed drivers for these USB-to-serial converters on your computer before, you should do so right now.
CP210x USB to UART Bridge VCP Drivers
Testing the Installation
To test the ESP8266 add-on installation, we’ll upload a simple code that blinks the on-board LED (GPIO 2).
Copy the following code to your Arduino IDE:
/********* Rui Santos Complete project details at https://RandomNerdTutorials.com/vs-code-platformio-ide-esp32-esp8266-arduino/ *********/ #include
#define LED 2 void setup() { // put your setup code here, to run once: Serial.begin(115200); pinMode(LED, OUTPUT); } void loop() { // put your main code here, to run repeatedly: digitalWrite(LED, HIGH); Serial.println("LED is on"); delay(1000); digitalWrite(LED, LOW); Serial.println("LED is off"); delay(1000); }
Uploading the Sketch
On the top drop-down menu, select the “unknown” board. A new window, as shown below, will open.
You should select your ESP8266 board model and the COM port. In our example, we’re using the NodeMCU 1.0 board. Click OK when you’re done.
Now, you just need to click on the Upload button.
After a few seconds, the upload should be complete.
The ESP8266 on-board LED should be blinking every second.
Serial Monitor
You can click on the Serial Monitor icon to open the Serial Monitor tab.
That’s it! You’ve installed the ESP8266 Boards successfully in Arduino IDE 2.0.
Wrapping Up
This is a quick guide that illustrates how to prepare your Arduino IDE for the ESP8266 on a Windows PC, Mac OS X, or Linux computer.
Next, you might want to read: Getting started with ESP8266.
That’s it, you’re ready to start building your own IoT projects with the ESP8266!
- Home Automation Using ESP8266
- ESP8266 Web Server Step-by-step
- ESP8266 Wi-Fi Button – DIY Amazon Dash Button Clone
- ESP8266 Daily Task – Publish Temperature Readings to ThingSpeak
- ESP8266 Weather Forecaster
- Nextion Display with ESP8266 – Touchscreen User Interface for Node-RED
- More ESP8266 projects…
Do you have any questions? Leave a comment below!
Thanks for reading. If you like this post probably you might like my next ones, so subscribe to my newsletter.
Installing¶
Wrapping Up
This is a quick guide that shows how to prepare Arduino IDE 2.0 for the ESP8266 Boards on a Windows PC, Mac OS X, or Linux computer.
Next, you might want to read: Getting started with ESP8266 or learn more about the ESP8266 board with our resources:
This is the suggested installation method for end users.
http://arduino.esp8266.com/stable/package_esp8266com_index.jsoninto Additional Board Manager URLs field. You can add multiple URLs, separating them with commas.
You may optionally use staging boards manager package link:
http://arduino.esp8266.com/staging/package_esp8266com_index.json
. This may contain some new features, but at the same time, some things might be broken.
This is the suggested installation method for contributors and library developers.
/Arduino), or the directory of Arduino application itself, the choice is up to you.
Clone this repository into hardware/esp8266com/esp8266 directory. Alternatively, clone it elsewhere and create a symlink, if your OS supports them.
cd hardware mkdir esp8266com cd esp8266com git clone https://github.com/esp8266/Arduino.git esp8266
You should end up with the following directory structure:
Arduino | --- hardware | --- esp8266com | --- esp8266 | --- bootloaders --- cores --- doc --- libraries --- package --- tests --- tools --- variants --- platform.txt --- programmers.txt --- README.md --- boards.txt --- LICENSE
Download binary tools
cd esp8266/tools python get.py
Restart Arduino
This article covers the ESP8266 installation in Arduino IDE.
Boards Manager¶
This is the suggested installation method for end users.
Prerequisites¶
-
Internet connection
-
Arduino IDE 1.x or 2.x (https://www.arduino.cc/en/software)
-
(macOS/Linux only) Python ≥3.7 (https://python.org)
Instructions¶
-
Start Arduino and open Preferences window.
-
Enter
https://arduino.esp8266.com/stable/package_esp8266com_index.json
into Additional Board Manager URLs field. You can add multiple URLs, separating them with commas. -
Open Boards Manager from Tools > Board menu and find esp8266 platform.
-
Select the version you need from a drop-down box.
-
Click install button.
-
Don’t forget to select your ESP8266 board from Tools > Board menu after installation.
For more information on the Arduino Board Manager, see:
Prerequisites: Arduino IDE 2.0 Installed
Before proceeding make sure you have Arduino IDE 2.0 installed on your computer.
Go to the Arduino website and download the version for your operating system.
- Windows: run the file downloaded and follow the instructions in the installation guide.
- Mac OS X: copy the downloaded file into your application folder.
- Linux: extract the downloaded file, and open the arduino-ide file that will launch the IDE.
If you have doubts, you can go to the Arduino Installation Guide.
Do you need an ESP8266 board? You can buy it here.
Recommended reading: Best ESP8266 Boards Comparison
Testing the Installation
To test the ESP8266 add-on installation, let’s see if we can blink an LED with the ESP8266 using the Arduino programming language.
Parts Required
Here’s the hardware that you need to complete this project:
If you’re using an ESP8266-01, you also need an FTDI programmer to upload code.
You can use the preceding links or go directly to MakerAdvisor.com/tools to find all the parts for your projects at the best price!
Step 3: Installing the ESP8266 Arduino Core
Launch the Arduino IDE and navigate to File > Preferences.
Fill in the “Additional Board Manager URLs” field with the following.
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Then, click the “OK” button.
Now navigate to Tools > Board > Boards Manager…
Filter your search by entering ‘esp8266‘. Look for ESP8266 by ESP8266 Community. Click on that entry, and then choose Install.
Table of Content
Installing the ESP8266 Board in Arduino IDE
- Step 1: Open the Arduino IDE
- Step 2: Go to Arduino Preferences
- Step 3: Enter the ESP8266 Board Manager URL
- Step 4: Open the Boards Manager
- Step 5: Install the ESP8266 Board
- Step 6: Select the ESP8266 Board
How to Program ESP8266 Using Arduino IDE
Step 13: Adding Libraries
In case you need to add the libraries to the Arduino follow the example path is shown in the figure i.e C:\Users\Armtronix\Documents\Arduino\libraries. Enter into the libraries folder then paste the file in that as shown below.
There are several development platforms available for programming the ESP8266. You can go with:
- Arduino IDE – intended for those who are familiar with Arduino
- Espruino – JavaScript SDK and firmware closely emulating Node.js
- Mongoose OS – An operating system for IoT devices that is recommended by Espressif Systems and Google Cloud IoT
- MicroPython – Implementation of Python 3 for microcontrollers
- SDK provided by Espressif – Official SDK to take advantage of all ESP8266 features
When compared to other platforms, the Arduino IDE is the most user-friendly for beginners. While it may not be the ideal platform for working with the ESP8266, it is a program that most people are already familiar with, which makes getting started much easier.
Before you can use the Arduino IDE to program the ESP8266, you must first install the ESP8266 board (also known as the ESP8266 Arduino Core) via the Arduino Board Manager. This guide will walk you through the process of downloading, installing, and testing the ESP8266 Arduino Core.
What is a Core?
The cores are required to make new microcontrollers compatible with your Arduino IDE as well as existing sketches and libraries. Arduino develops the cores for the microcontrollers (Atmel AVR MCUs) used on their boards, but anyone can develop a core for their own boards as long as they follow the rules and requirements set by Arduino.
Some development boards require the installation of an additional core; therefore, Arduino developed the Boards Manager as a tool to add cores to the Arduino IDE.
For more information on how to use the Arduino IDE Boards Manager, check out their tutorial.
Install ESP8266 NodeMCU Add-on in Arduino IDE
To install the ESP8266 board in your Arduino IDE, follow these next instructions:
1. In your Arduino IDE 2.0, go to File > Preferences.
2. Copy and paste the following line to the Additional Boards Manager URLs field.
http://arduino.esp8266.com/stable/package_esp8266com_index.json
Note: if you already have the ESP32 boards URL, you can separate the URLs with a comma, as follows:
http://arduino.esp8266.com/stable/package_esp8266com_index.json, https://raw.githubusercontent.com/espressif/arduino-esp32/gh-pages/package_esp32_index.json
3. Open the Boards Manager. You can go to Tools > Board > Boards Manager… or you can simply click the Boards Manager icon in the left-side corner.
4. Search for ESP8266 and press the install button for esp8266 by ESP8266 Community.
That’s it. It should be installed after a few seconds.
Install ESP8266 Add-on in Arduino IDE
To install the ESP8266 board in your Arduino IDE, follow these next instructions:
-
In your Arduino IDE, go to File> Preferences
-
Enter http://arduino.esp8266.com/stable/package_esp8266com_index.json into the “Additional Boards Manager URLs” field as shown in the figure below. Then, click the “OK” button:
Note: if you already have the ESP32 boards URL, you can separate the URLs with a comma as follows:
https://dl.espressif.com/dl/package_esp32_index.json, http://arduino.esp8266.com/stable/package_esp8266com_index.json
-
Open the Boards Manager. Go to Tools > Board > Boards Manager…
-
Search for ESP8266 and press install button for the “ESP8266 by ESP8266 Community“:
-
That’s it. It should be installed after a few seconds.
Conclusion
The ESP8266 board in IDE can be installed using the JSON file. We just have to add it in the additional board manager inside the preferences settings. Once you’ve installed the board, you’ll be able to program the ESP8266 with the help of Arduino IDE.
Arduino core for ESP8266 WiFi chip
Quick links
Arduino on ESP8266
This project brings support for the ESP8266 chip to the Arduino environment. It lets you write sketches, using familiar Arduino functions and libraries, and run them directly on ESP8266, with no external microcontroller required.
ESP8266 Arduino core comes with libraries to communicate over WiFi using TCP and UDP, set up HTTP, mDNS, SSDP, and DNS servers, do OTA updates, use a file system in flash memory, and work with SD cards, servos, SPI and I2C peripherals.
Contents
- Installing options:
- Documentation
- Issues and support
- Contributing
- License and credits
Installing with Boards Manager
Starting with 1.6.4, Arduino allows installation of third-party platform packages using Boards Manager. We have packages available for Windows, Mac OS, and Linux (32 and 64 bit).
- Download and install Arduino IDE 1.x or 2.x
- Start Arduino and open the Preferences window
-
Enter
https://arduino.esp8266.com/stable/package_esp8266com_index.json
into the File>Preferences>Additional Boards Manager URLs field of the Arduino IDE. You can add multiple URLs, separating them with commas. - Open Boards Manager from Tools > Board menu and install esp8266 platform (and don’t forget to select your ESP8266 board from Tools > Board menu after installation).
Boards manager link:
https://arduino.esp8266.com/stable/package_esp8266com_index.json
Documentation: https://arduino-esp8266.readthedocs.io/en/3.1.2/
Using git version
Also known as latest git or master branch.
- When using Arduino IDE, follow our instructions here.
- When using PlatformIO, refer to platformio/espressif8266 platform documentation.
Using PlatformIO
PlatformIO is an open source ecosystem for IoT development with a cross-platform build system, a library manager, and full support for Espressif (ESP8266) development. It works on the following popular host operating systems: macOS, Windows, Linux 32/64, and Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
- What is PlatformIO?
- PlatformIO IDE
- PlatformIO Core (command line tool)
- Advanced usage – custom settings, uploading to SPIFFS, Over-the-Air (OTA), staging version
- Integration with Cloud and Standalone IDEs – Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
- Project Examples
Building with make
makeEspArduino is a generic makefile for any ESP8266 Arduino project. Using make instead of the Arduino IDE makes it easier to do automated and production builds.
Documentation
Documentation for latest development version: https://arduino-esp8266.readthedocs.io/en/latest/
Issues and support
ESP8266 Community Forum is a well-established community for questions and answers about Arduino for ESP8266. Stackoverflow is also an alternative. If you need help, have a “How do I…” type question, have a problem with a 3rd party library not hosted in this repo, or just want to discuss how to approach a problem, please ask there.
If you find the forum useful, please consider supporting it with a donation.
If you encounter an issue which you think is a bug in the ESP8266 Arduino Core or the associated libraries, or if you want to propose an enhancement, you are welcome to submit it here on Github: https://github.com/esp8266/Arduino/issues.
Please provide as much context as possible, as well as the information requested in the issue template:
- ESP8266 Arduino core version which you are using (you can check it in Boards Manager)
- your sketch code; please wrap it into a code block, see Github markdown manual
- when encountering an issue that happens at run time, attach the serial output. Wrap it into a code block, just like the code.
- for issues that happen at compile time, enable verbose compiler output in the IDE preferences, and attach that output (also inside a code block)
- ESP8266 development board model
- IDE settings (board choice, flash size)
- etc
Contributing
For minor fixes of code and documentation, please go ahead and submit a pull request. A gentle introduction to the process can be found here.
Check out the list of issues that are easy to fix — easy issues pending. Working on them is a great way to move the project forward.
Larger changes (rewriting parts of existing code from scratch, adding new functions to the core, adding new libraries) should generally be discussed by opening an issue first. PRs with such changes require testing and approval.
Feature branches with lots of small commits (especially titled “oops”, “fix typo”, “forgot to add file”, etc.) should be squashed before opening a pull request. At the same time, please refrain from putting multiple unrelated changes into a single pull request.
License and credits
Arduino IDE is developed and maintained by the Arduino team. The IDE is licensed under GPL.
ESP8266 core includes an xtensa gcc toolchain, which is also under GPL.
Esptool.py was initially created by Fredrik Ahlberg (@themadinventor, @kongo), and is currently maintained by Angus Gratton (@projectgus) under GPL 2.0 license.
Espressif’s NONOS SDK included in this build is under Espressif MIT License.
ESP8266 core files are licensed under LGPL.
SPI Flash File System (SPIFFS) written by Peter Andersson is used in this project. It is distributed under the MIT license.
umm_malloc memory management library written by Ralph Hempel is used in this project. It is distributed under the MIT license.
SoftwareSerial library and examples written by Peter Lerup. Distributed under LGPL 2.1.
BearSSL library written by Thomas Pornin, built from https://github.com/earlephilhower/bearssl-esp8266, is used in this project. It is distributed under the MIT License.
LittleFS library written by ARM Limited and released under the BSD 3-clause license.
uzlib library written and (c) 2014-2018 Paul Sokolovsky, licensed under the ZLib license (https://www.zlib.net/zlib_license.html). uzlib is based on: tinf library by Joergen Ibsen (Deflate decompression); Deflate Static Huffman tree routines by Simon Tatham; LZ77 compressor by Paul Sokolovsky; with library integrated and maintained by Paul Sokolovsky.
Other useful links
Serial Monitor Arduino IDE plugin Original discussion here, quick download there.
Step 12: Uploading the Program to ESP8266 Module
On the blink example code change all number 13 to number 16 and then click on the right arrow shown in the figure to upload the program to the module. This will start blinking the on board led on the nodemcu module
void setup()
{// initialize digital pin 16 as an output.
pinMode(16, OUTPUT);
// the loop function runs over and over again forever
void loop()
delay(10);
digitalWrite(16, HIGH); // turn the LED on (HIGH is the voltage level)
delay(1000); // wait for a second
digitalWrite(16, LOW); // turn the LED off by making the voltage LOW
delay(1000); // wait for a second
Step 4: Selecting the Board and Port
After installing the ESP8266 Arduino Core, restart your Arduino IDE and navigate to Tools > Board to ensure you have ESP8266 boards available.
Now select your board in the Tools > Board menu (in our case, it’s the NodeMCU 1.0 (ESP-12E Module)). If you are unsure which board you have, select the Generic ESP8266 Module.
Finally, connect the ESP8266 NodeMCU to your computer and select the Port.
That’s it! You can now begin writing code for your ESP8266 in the Arduino IDE.
You should make sure you always have the most recent version of the ESP8266 Arduino core installed.
Simply navigate to Tools > Board > Boards Manager, search for ESP8266, and verify the version you have installed. If a newer version is available, you should install it.
Step 5: Testing the Installation
Once you’ve finished the preceding steps, you are ready to test your first program with your ESP8266! Launch the Arduino IDE. If you disconnected your board, plug it back in.
The ESP8266 Arduino core includes several examples that demonstrate everything from scanning for nearby networks to building a web server. To access the example sketches, navigate to File > Examples > ESP8266.
You will see a selection of example sketches. You can choose any of them to load the sketch into your IDE and begin experimenting.
Let’s upload the most basic sketch of all – Blink! Navigate to File > Examples > ESP8266, and open the Blink sketch.
This sketch uses the on-board LED that most ESP8266 development boards have. This LED is typically connected to digital pin D0, and its number may vary from board to board.
void setup() { pinMode(D0, OUTPUT); } void loop() { digitalWrite(D0, HIGH); delay(500); digitalWrite(D0, LOW); delay(500); }
If everything worked, the on-board LED on your ESP8266 should now be blinking! To execute the sketch, you may need to press the RST button on your ESP8266.
Congratulations! You have just programmed your first ESP8266!
ESP8266 Example: WiFi Scan
Let’s try to run another ESP8266 example sketch, which demonstrates how to use the ESP8266WiFi library to scan nearby WiFi networks and print the results.
You can find this example under File > Examples > ESP8266WiFi > WiFiScan.
Load the WiFiScan sketch from the example sketches into your Arduino IDE.
#include
void setup() { Serial.begin(115200); Serial.println(F("\nESP8266 WiFi scan example")); // Set WiFi to station mode WiFi.mode(WIFI_STA); // Disconnect from an AP if it was previously connected WiFi.disconnect(); delay(100); } void loop() { String ssid; int32_t rssi; uint8_t encryptionType; uint8_t* bssid; int32_t channel; bool hidden; int scanResult; Serial.println(F("Starting WiFi scan...")); scanResult = WiFi.scanNetworks(/*async=*/false, /*hidden=*/true); if (scanResult == 0) { Serial.println(F("No networks found")); } else if (scanResult > 0) { Serial.printf(PSTR("%d networks found:\n"), scanResult); // Print unsorted scan results for (int8_t i = 0; i < scanResult; i++) { WiFi.getNetworkInfo(i, ssid, encryptionType, rssi, bssid, channel, hidden); Serial.printf(PSTR(" %02d: [CH %02d] [%02X:%02X:%02X:%02X:%02X:%02X] %ddBm %c %c %s\n"), i, channel, bssid[0], bssid[1], bssid[2], bssid[3], bssid[4], bssid[5], rssi, (encryptionType == ENC_TYPE_NONE) ? ' ' : '*', hidden ? 'H' : 'V', ssid.c_str()); delay(0); } } else { Serial.printf(PSTR("WiFi scan error %d"), scanResult); } // Wait a bit before scanning again delay(5000); }
Once you have uploaded the sketch, open the serial monitor at baud rate 115200 and press the RST button on the ESP8266. You should see the SSID, RSSI, WiFi channel, and encryption for each discovered network.
Using PlatformIO¶
PlatformIO is an open source ecosystem for IoT development with a cross-platform build system, a library manager, and full support for Espressif (ESP8266) development. It works on the following popular host operating systems: macOS, Windows, Linux 32/64, and Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).
-
PlatformIO Core (command line tool)
-
Advanced usage – custom settings, uploading to LittleFS, Over-the-Air (OTA), staging version
-
Using Arduino Framework Staging Version – install development version of the Core
-
Integration with Cloud and Standalone IDEs – Cloud9, Codeanywhere, Eclipse Che (Codenvy), Atom, CLion, Eclipse, Emacs, NetBeans, Qt Creator, Sublime Text, VIM, Visual Studio, and VSCode
There is a new Arduino IDE—Arduino IDE 2.0 (beta version). In this tutorial, you’ll learn how to install the ESP8266 boards in Arduino IDE 2.0 and upload code to the board. This tutorial is compatible with Windows, Mac OS X, and Linux operating systems.
Accordingly to the Arduino website: “The Arduino IDE 2.0 is an improvement of the classic IDE, with increased performance, improved user interface and many new features, such as autocompletion, a built-in debugger and syncing sketches with Arduino Cloud“.
If you want to install the ESP8266 boards on the “classic” Arduino IDE, follow the next tutorial instead:
If you prefer programming the ESP8266 using VS Code + PlatformIO, go to the following tutorial:
- Getting Started with VS Code and PlatformIO IDE for ESP32 and ESP8266 (Windows, Mac OS X, Linux Ubuntu)
You might also like reading the ESP32 Guide: Installing ESP32 Board in Arduino IDE 2.0 (Windows, Mac OS X, Linux)
Keywords searched by users: esp8266 arduino ide install
Categories: Sưu tầm 81 Esp8266 Arduino Ide Install
See more here: kientrucannam.vn
See more: https://kientrucannam.vn/vn/