#WioTerminal – Connecting to Wifi 📶, display local IP and get ready for Azure ☁️ scenarios !

Hi !

Another fast post to cover a super important scenario:

Connect to a Wifi network in the Wio Terminal.

The code and implementation are extremely simple for this, and with a couple of lines of code, we can connect and also display the local IP.

WioTerminal Connect to Wifi and display IP

Source Code

As usual, the full code is below and some notes

  • The Wifi mode must be set to STA and also must be disconnected before starting a new connection.
  • I added a counter to display how much time takes to connect to the WiFi network.
  • This can also be used for a timeout control.
  • I also display the IP address assigned to the device.
#include "rpcWiFi.h"
#include <WiFiClientSecure.h>
TFT_eSPI tft;
const char* ssid = "yourNetworkName";
const char* password = "yourNetworkPassword";
int connectingSeconds = 0;
WiFiClientSecure client;
void setup() {
tft.setCursor(40, 50);
tft.print("El Bruno – @elbruno");
tft.setCursor(40, 75);
tft.print("Connecting to Wi-Fi..");
// Set WiFi to station mode and disconnect from an AP if it was previously connected
WiFi.begin(ssid, password);
// attempt to connect to Wifi network:
while (WiFi.status() != WL_CONNECTED) {
tft.setCursor(40, 100);
tft.print("Seconds waiting: ");
tft.setCursor((40 + tft.textWidth("Seconds waiting: ")), 100);
// wait 1 second for re-trying
WiFi.begin(ssid, password);
tft.setCursor(40, 125);
tft.setCursor(40, 150);
tft.print("IP: ");
tft.setCursor((40 + tft.textWidth("IP: ")), 150);
void loop() {
// do nothing

Now we are connected, so we can start to interact with Azure resources !

Happy coding!


El Bruno

More posts in my blog ElBruno.com.

More info in https://beacons.ai/elbruno


¿Con ganas de ponerte al día?

En Lemoncode te ofrecemos formación online impartida por profesionales que se baten el cobre en consultoría:


Leave a comment

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: