matekasse_NFC-Reader/oled.py

32 lines
904 B
Python
Raw Normal View History

2024-04-12 19:20:15 +00:00
# This example and library is meant to work with Adafruit CircuitPython API.
# Author: Tony DiCola
# License: Public Domain
# Import all board pins.
2024-04-12 19:32:20 +00:00
from board import SCL, SDA
2024-04-12 19:20:15 +00:00
import busio
# Import the SSD1306 module.
import adafruit_ssd1306
# Create the I2C interface.
i2c = busio.I2C(SCL, SDA)
# Create the SSD1306 OLED class.
# The first two parameters are the pixel width and pixel height. Change these
# to the right size for your display!
2024-04-12 19:34:37 +00:00
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
2024-04-12 19:20:15 +00:00
# Alternatively you can change the I2C address of the device with an addr parameter:
2024-04-12 19:34:37 +00:00
#display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31)
2024-04-12 19:20:15 +00:00
# Clear the display. Always call show after changing pixels to make the display
# update visible!
display.fill(0)
display.show()
2024-04-12 19:36:26 +00:00
display.text("Test", 0, 0, (255,255,255), size=1)
2024-04-12 19:39:21 +00:00
display.text("Tets2", 0, 10, (255,255,255), size=2)
2024-04-12 19:20:15 +00:00
display.show()