Afisare iconite pe display LCD I2C

In continuarea articolului anterior putem aduce modificari la afisare prin adaugarea de diferite iconite pe langa alte informatii.

Pentru a face acest lucru vom folosi exemplu din codul de mai jos:

from i2c_lcd import I2cLcd
from machine import I2C
from machine import Pin
import utime as time

i2c = I2C(id=0, scl=Pin(1), sda=Pin(0), freq = 100000)
lcd = I2cLcd(i2c, 0x27, 4, 20)
grad = bytearray([0x1c, 0x14, 0x1c, 0x00, 0x00, 0x00, 0x00, 0x00])
lcd.custom_char(0, grad)
impuls = bytearray([0x00, 0x00, 0x0E, 0x0A, 0x0A, 0x0A, 0x0A, 0x11])
lcd.custom_char(1, impuls)
ceas = bytearray([0x0E, 0x15, 0x17, 0x11, 0x0E, 0x00, 0x00, 0x00])
lcd.custom_char(2, ceas)
clepsidra = bytearray([0x00, 0x1F, 0x1F, 0x0E, 0x04, 0x0A, 0x11, 0x1F])
lcd.custom_char(3, clepsidra)
soare = bytearray([0x00, 0x04, 0x15, 0x0E, 0x1F, 0x0E, 0x15, 0x04])
lcd.custom_char(4, soare)
termometru = bytearray([0x04, 0x0A, 0x0A, 0x0E, 0x0E, 0x1F, 0x1F, 0x0E])
lcd.custom_char(5, termometru)
picatura = bytearray([ 0x04, 0x04, 0x0A, 0x0A, 0x11, 0x11, 0x11, 0x0E])
lcd.custom_char(6, picatura)
difuzor = bytearray([0x01, 0x03, 0x07, 0x1F, 0x1F, 0x07, 0x03, 0x01])
lcd.custom_char(7, difuzor)
temp = 25
while True:
    lcd.move_to(0, 0)
    lcd.putstr("Temp: "+str(temp)+chr(0)+"C")
    lcd.move_to(0, 1)
    lcd.putstr(chr(1)+" "+chr(2)+" "+chr(3)+" "+chr(4)+" "+chr(5)+" "+chr(6)+" "+chr(7))
    time.sleep(1)
    lcd.clear()
    time.sleep(1)

Nu sunt comentarii in “Afisare iconite pe display LCD I2C ”

Lasa un comentariu

Raspuns lui Some User

Autentificare