test
This commit is contained in:
parent
814e001db3
commit
a8757475d3
1 changed files with 10 additions and 22 deletions
30
oled.py
30
oled.py
|
@ -1,31 +1,19 @@
|
||||||
# This example and library is meant to work with Adafruit CircuitPython API.
|
|
||||||
# Author: Tony DiCola
|
|
||||||
# License: Public Domain
|
|
||||||
|
|
||||||
# Import all board pins.
|
|
||||||
from board import SCL, SDA
|
from board import SCL, SDA
|
||||||
import busio
|
import busio
|
||||||
|
|
||||||
# Import the SSD1306 module.
|
|
||||||
import adafruit_ssd1306
|
import adafruit_ssd1306
|
||||||
|
|
||||||
|
|
||||||
# Create the I2C interface.
|
|
||||||
i2c = busio.I2C(SCL, SDA)
|
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!
|
|
||||||
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
|
display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c)
|
||||||
# Alternatively you can change the I2C address of the device with an addr parameter:
|
|
||||||
#display = adafruit_ssd1306.SSD1306_I2C(128, 32, i2c, addr=0x31)
|
|
||||||
|
|
||||||
# Clear the display. Always call show after changing pixels to make the display
|
def clear():
|
||||||
# update visible!
|
|
||||||
display.fill(0)
|
display.fill(0)
|
||||||
|
|
||||||
display.show()
|
display.show()
|
||||||
|
|
||||||
display.text("Test", 0, 0, (255,255,255), size=1)
|
def Balance(user_id, user_name, balance):
|
||||||
display.text("Tets2", 0, 10, (255,255,255), size=2)
|
clear()
|
||||||
display.show()
|
display.text(str(user_id), 0, 0, (255,255,255), size=1)
|
||||||
|
display.text(str(user_name), 50, 0, (255,255,255), size=1)
|
||||||
|
display.text(str(balance), 0, 50, (255,255,255, size=2))
|
||||||
|
|
||||||
|
if __name__ == "__main__":
|
||||||
|
Balance(1, "Test", 255)
|
||||||
|
|
Loading…
Reference in a new issue