Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- disp = LCD.PCD8544(DC, RST, spi=SPI.SpiDev(SPI_PORT, SPI_DEVICE, max_speed_hz=4000000))
- disp.begin(contrast=55)
- disp.clear()
- disp.display()
- image = Image.open('background.png').resize((LCD.LCDWIDTH, LCD.LCDHEIGHT), Image.ANTIALIAS).convert('1')
- draw = ImageDraw.Draw(image)
- font = ImageFont.truetype('pixellari.ttf', 16)
- smallfont = ImageFont.truetype('minecraftia.ttf',8)
- draw.text((18,2), '{0:.1f}'.format(temperature), font=font)
- draw.text((18,18), '{0:.1f}'.format(humidity), font=font)
- draw.text((18,34), '{0:.1f}'.format(pressure), font=font)
- draw.text((59,-1), datetime.datetime.now().strftime('%H:%M'), font=smallfont)
- disp.image(image)
- disp.display()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement