Skip to main content

Inkplate 13SPECTRA MicroPython - Initialization and connection

Inkplate 13SPECTRA can use its built-in ESP32-S3 WiFi capabilities to connect to the internet. This page demonstrates a simple way to connect to a WiFi network.


Connecting to WiFi

Below is a simple example demonstrating how to connect to a WiFi network.

ℹ️
You only need to enter your SSID and password in the code example.
# Include needed libraries
import network
import time
from inkplate13SPECTRA import Inkplate

# Enter your WiFi credentials here
ssid = "YOUR_SSID_HERE"
password = "YOUR_PASSWORD_HERE"

# Function which connects to WiFi
# More info here: https://docs.micropython.org/en/latest/esp8266/tutorial/network_basics.html
def do_connect():
import network
sta_if = network.WLAN(network.STA_IF)
if not sta_if.isconnected():
print("connecting to network...")
sta_if.active(True)
sta_if.connect(ssid, password)
while not sta_if.isconnected():
pass
print("network config:", sta_if.ifconfig())
return True

inkplate=Inkplate()
inkplate.begin()
inkplate.setTextSize(2)

if do_connect():
inkplate.print("Wifi connected")
else:
inkplate.print("Wifi failed")

inplate.display()

Example output displayed on e-paper display
Example output displayed on e-paper display

network.WLAN()

Create or access a WiFi network interface object.

Function parameters:

TypeNameDescription
Constantnetwork.STA_IFUse WiFi in station (client) mode.

sta_if.connect()

Connects to a WiFi network with the given SSID and password.

Function parameters:

TypeNameDescription
StringSSIDThe WiFi network name.
StringPASSWORDThe WiFi password.