Skip to content

Instantly share code, notes, and snippets.

Created March 1, 2023 21:33
What would you like to do?
"Hello World" for a MatrixPortal M4 connected to two 64x32 LED panels; dependent on
import board
import busio
from digitalio import DigitalInOut, Pull
import neopixel
from adafruit_matrixportal.matrix import Matrix
from adafruit_esp32spi import adafruit_esp32spi
from adafruit_esp32spi import adafruit_esp32spi_wifimanager
import display_manager
# --- SECRETS SETUP ----
from secrets import secrets
print("secrets loaded")
except ImportError:
print("Wifi + constants are kept in, please add them there!")
# --- INITIALIZE DISPLAY -----------------------------------------------
matrix = Matrix(width=128, height=32, bit_depth=2, tile_rows=1)
display_manager = display_manager.display_manager(matrix.display)
print("display manager loaded")
# --- WIFI SETUP -------------
# Initialize ESP32 Pins:
esp32_cs = DigitalInOut(board.ESP_CS)
esp32_ready = DigitalInOut(board.ESP_BUSY)
esp32_reset = DigitalInOut(board.ESP_RESET)
# Initialize wifi components
spi = busio.SPI(board.SCK, board.MOSI, board.MISO)
esp = adafruit_esp32spi.ESP_SPIcontrol(spi, esp32_cs, esp32_ready, esp32_reset)
# Initialize neopixel status light
status_light = neopixel.NeoPixel(board.NEOPIXEL, 1, brightness=0.2)
# Initialize wifi object
wifi = adafruit_esp32spi_wifimanager.ESPSPI_WiFiManager(esp, secrets, status_light)
print("WiFi loaded")
while True:
display_manager.update_label("Hello World!")
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment