matekasse_NFC-Reader/oled.py
2024-04-17 19:46:43 +02:00

27 lines
661 B
Python

from board import SCL, SDA
import busio
import adafruit_ssd1306
import time
i2c = busio.I2C(SCL, SDA)
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
def clear():
display.fill(0)
display.show()
async def balance(user_name, balance):
await clear()
display.text(str(user_name), 50, 0, (255,255,255), size=1)
display.text(str(balance), 0, 15, (255,255,255), size=2)
display.show()
await time.sleep(5)
await clear()
def error(code):
clear()
display.text("!!!!ERROR!!!!", 50, 0 (255,255,255), size=2)
display.text(str(code), 50, 10, (255,255,255), size=2)
if __name__ == "__main__":
Balance("Test", -255555)