34 lines
652 B
Python
34 lines
652 B
Python
import board
|
|
import busio
|
|
import displayio
|
|
import terminalio
|
|
import adafruit_displayio_ssd1306
|
|
from adafruit_display_text import label
|
|
import time
|
|
import digitalio
|
|
|
|
# Display
|
|
WIDTH = 128
|
|
HEIGHT = 32
|
|
CENTER_X = int(WIDTH/2)
|
|
CENTER_Y = int(HEIGHT/2)
|
|
|
|
displayio.release_displays()
|
|
|
|
SDA = board.GP0
|
|
SCL = board.GP1
|
|
i2c = busio.I2C(SCL, SDA)
|
|
|
|
display_bus = displayio.I2CDisplay(i2c, device_address=60)
|
|
display = adafruit_displayio_ssd1306.SSD1306(display_bus, width=128, height=32)
|
|
|
|
text = "HELLO WORLD"
|
|
font = terminalio.FONT
|
|
color = 0xFFFFFF
|
|
|
|
text_area = label.Label(font, text=text, color=color)
|
|
|
|
text_area.x = 1
|
|
text_area.y = 12
|
|
|
|
display.show(text_area) |