test
This commit is contained in:
parent
4d995d1a09
commit
b91687c3b6
1 changed files with 10 additions and 0 deletions
10
oled.py
10
oled.py
|
@ -2,12 +2,22 @@ from luma.core.interface.serial import i2c, spi, pcf8574
|
||||||
from luma.core.interface.parallel import bitbang_6800
|
from luma.core.interface.parallel import bitbang_6800
|
||||||
from luma.core.render import canvas
|
from luma.core.render import canvas
|
||||||
from luma.oled.device import ssd1306
|
from luma.oled.device import ssd1306
|
||||||
|
from PIL import ImageFont
|
||||||
|
from pathlib import Path
|
||||||
import time
|
import time
|
||||||
|
|
||||||
serial = i2c(port=1, address=0x3C)
|
serial = i2c(port=1, address=0x3C)
|
||||||
|
|
||||||
device = ssd1306(serial)
|
device = ssd1306(serial)
|
||||||
|
|
||||||
|
def make_font(name, size):
|
||||||
|
font_path = str(Path(__file__).resolve().parent.joinpath('fonts', name))
|
||||||
|
return ImageFont.truetype(font_path, size)
|
||||||
|
|
||||||
|
def balance(user_name, balance):
|
||||||
|
with canvas(device) as draw:
|
||||||
|
pass
|
||||||
|
|
||||||
with canvas(device) as draw:
|
with canvas(device) as draw:
|
||||||
#draw.rectangle(device.bounding_box, outline="white", fill="black")
|
#draw.rectangle(device.bounding_box, outline="white", fill="black")
|
||||||
draw.text((30, 0), "Hello World", fill="white")
|
draw.text((30, 0), "Hello World", fill="white")
|
||||||
|
|
Loading…
Reference in a new issue