mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2025-01-23 20:39:26 +00:00
35 lines
752 B
Python
Executable File
35 lines
752 B
Python
Executable File
# Import LCD library
|
|
from RPLCD import i2c
|
|
|
|
|
|
# constants to initialise the LCD
|
|
lcdmode = 'i2c'
|
|
cols = 20
|
|
rows = 4
|
|
charmap = 'A00'
|
|
i2c_expander = 'PCF8574'
|
|
|
|
# Generally 27 is the address;Find yours using: i2cdetect -y 1
|
|
address = 0x27
|
|
port = 0 # 0 on an older Raspberry Pi
|
|
|
|
# Initialise the LCD
|
|
lcd = i2c.CharLCD(i2c_expander, address, port=port, charmap=charmap,
|
|
cols=cols, rows=rows)
|
|
lcd.clear()
|
|
line1 = f'{"####": <20}'
|
|
line2 = f'{"Starting....": <20}'
|
|
line3 = f'{"####": <20}'
|
|
line4 = f'{"####": <20}'
|
|
lcd.backlight_enabled = True
|
|
lcd.cursor_pos = (0, 0)
|
|
lcd.write_string(line1)
|
|
lcd.crlf()
|
|
lcd.write_string(line2)
|
|
lcd.crlf()
|
|
lcd.write_string(line3)
|
|
lcd.crlf()
|
|
lcd.write_string(line4)
|
|
lcd.crlf()
|
|
lcd.clear()
|
|
lcd.close(clear=True) |