-
-
Save TristanAmond/eca90b5e9b385a50d21519d3b2bd29a0 to your computer and use it in GitHub Desktop.
"Hello World" for a MatrixPortal M4 connected to two 64x32 LED panels; dependent on display_manager.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 ---- | |
try: | |
from secrets import secrets | |
print("secrets loaded") | |
except ImportError: | |
print("Wifi + constants are kept in secrets.py, please add them there!") | |
raise | |
# --- INITIALIZE DISPLAY ----------------------------------------------- | |
# MATRIX DISPLAY MANAGER | |
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!") | |
display_manager.refresh_display() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment