This page has no translation to Italiano yet. The original English version is below. If you’d like to help, great! See how to translate a documentation page in the contribution guide.

Connecting to Internet With ESP8266-based MCUs

some of ESP8266-based boards

ESP8266-based boards such as NodeMCU and WeMos D1 Mini are quite popular for projects that require internet connection because of their built-in WiFi capabilities.

XOD provides xod-dev/esp8266-mcu library that makes connecting to the internet simple. All you need is a connect node:

connect node

Bind your network SSID and password to SSID and PWD pins and you are good to go.

Checking the Connection #

Let’s build a small patch to verify that connection is successful. First, it will print “Connecting” to the debugger, then (after a little delay) your local IP if connection was successful or “Error” if something went wrong.

connecting to wifi

The xod-dev/esp8266-mcu/lan-ip gets the IP address from INET and xod/net/format-ip formats the IP as a human-readable string like “192.168.88.101”.

To output the progress to the debugger we use select and console-log. Bind "Connecting" to select’s X1, On Boot to S1 and "Error" to X3.

Upload the patch to your board in debug mode. You should see something like this:

observing result in debugger

What’s Next #

Now that you have a working internet connection, it’s time to do something useful with it. For example, fetching some data with HTTP requests.

Found a typo or mistake? Want to improve the text? Edit this page on GitHub and open a pull request. If you have a complex proposal or you want to discuss the content, feel free to start a new thread on XOD forum.