#ASCII 5x8
font = bytearray(b'x00x00x00x00x00x00x00x5fx00x00x00x07x00x07x00x14x7fx14x7fx14x24x2ax7fx2ax12x23x13x08x64x62x36x49x55x22x50x00x05x03x00x00x00x1cx22x41x00x00x41x22x1cx00x14x08x3ex08x14x08x08x3ex08x08x00x50x30x00x00x08x08x08x08x08x00x60x60x00x00x20x10x08x04x02x3ex51x49x45x3ex00x42x7fx40x00x42x61x51x49x46x21x41x45x4bx31x18x14x12x7fx10x27x45x45x45x39x3cx4ax49x49x30x01x71x09x05x03x36x49x49x49x36x06x49x49x29x1ex00x36x36x00x00x00x56x36x00x00x08x14x22x41x00x14x14x14x14x14x00x41x22x14x08x02x01x51x09x06x32x49x79x41x3ex7ex11x11x11x7ex7fx49x49x49x36x3ex41x41x41x22x7fx41x41x22x1cx7fx49x49x49x41x7fx09x09x09x01x3ex41x49x49x7ax7fx08x08x08x7fx00x41x7fx41x00x20x40x41x3fx01x7fx08x14x22x41x7fx40x40x40x40x7fx02x0cx02x7fx7fx04x08x10x7fx3ex41x41x41x3ex7fx09x09x09x06x3ex41x51x21x5ex7fx09x19x29x46x46x49x49x49x31x01x01x7fx01x01x3fx40x40x40x3fx1fx20x40x20x1fx3fx40x38x40x3fx63x14x08x14x63x07x08x70x08x07x61x51x49x45x43x00x7fx41x41x00x02x04x08x10x20x00x41x41x7fx00x04x02x01x02x04x40x40x40x40x40x00x01x02x04x00x20x54x54x54x78x7fx48x44x44x38x38x44x44x44x20x38x44x44x48x7fx38x54x54x54x18x08x7ex09x01x02x0cx52x52x52x3ex7fx08x04x04x78x00x44x7dx40x00x20x40x44x3dx00x7fx10x28x44x00x00x41x7fx40x00x7cx04x18x04x78x7cx08x04x04x78x38x44x44x44x38x7cx14x14x14x08x08x14x14x18x7cx7cx08x04x04x08x48x54x54x54x20x04x3fx44x40x20x3cx40x40x20x7cx1cx20x40x20x1cx3cx40x30x40x3cx44x28x10x28x44x0cx50x50x50x3cx44x64x54x4cx44x00x08x36x41x00x00x00x7fx00x00x00x41x36x08x00x10x08x08x10x08x00x00x00x00x00')
#reset
def reset():
pin0.write_digital(0) # RST on
sleep(0.01)
pin0.write_digital(1) # RST off
def lcd_write(dc,data):
pin5.write_digital(dc)#DC=0 select CMD DC=1 select DATA
pin1.write_digital(0) #CE=0 open
spi.write(data)
pin1.write_digital(1) #CE=1 close
def lcd_print_string(message,x,y):
lcd_postion(x,y)
data = bytearray()
for letter in message:
i = (ord(letter) - 32)*5
for b in range (0,5):
data.append(font[i+b])
data.append(0x00)
lcd_write(1, data)