-
Notifications
You must be signed in to change notification settings - Fork 10
Expand file tree
/
Copy pathlcd.py
More file actions
35 lines (28 loc) · 714 Bytes
/
lcd.py
File metadata and controls
35 lines (28 loc) · 714 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
__author__ = 'beau'
from pyb import UART
class lcd():
def __init__(self,uart=3):
#UART serial
self.lcd = UART(uart, 115200) # init with given baudrate
#set lcd to same baudrate
b = bytearray(3)
b[0] = 0x7C
b[1] = 0x07
b[2] = 0x36
self.lcd.write(b)
#set background duty
b = bytearray(3)
b[0] = 0x7C
b[1] = 0x02
b[2] = 80
self.lcd.write(b)
def clear(self):
b = bytearray(2)
b[0] = 0x7c
b[1] = 0x00
self.lcd.write(b)
def send(self,string):
self.lcd.write(string)
def replace(self,string):
self.clear()
self.lcd.write(string)