62 lines
1.9 KiB
Python
62 lines
1.9 KiB
Python
"""
|
|
An example "program" which can be used with the lcdMenu library on a 2x16 display (with some tweaks also on 4x20 displays)
|
|
Copyright (C) 2024 Benjamin Burkhardt <bluefox@privacynerd.de>
|
|
|
|
This program is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version.
|
|
|
|
This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
|
|
|
|
You should have received a copy of the GNU General Public License along with this program. If not, see <https://www.gnu.org/licenses/>.
|
|
"""
|
|
|
|
|
|
"""
|
|
@ Feature: Demonstrates the lcd driver's functionality
|
|
"""
|
|
|
|
from time import sleep
|
|
from utils import log
|
|
|
|
# lcd is an object of the I2C_LCD class (https://git.privacynerd.de/BlueFox/micropython-libraries/src/branch/main/PCF8574T)
|
|
def run(lcd):
|
|
# Show off basic functionality of the lcd driver
|
|
log(2, "Running the lcd driver demo")
|
|
lcd.putstr("Driver demo".center(16))
|
|
sleep(1)
|
|
lcd.clear()
|
|
lcd.putstr("Lorem ipsum dolor sit amet")
|
|
sleep(1)
|
|
lcd.show_cursor()
|
|
sleep(1)
|
|
lcd.hide_cursor()
|
|
sleep(1)
|
|
lcd.blink_cursor_on()
|
|
sleep(1)
|
|
lcd.blink_cursor_off()
|
|
sleep(1)
|
|
lcd.backlight_off()
|
|
sleep(1)
|
|
lcd.backlight_on()
|
|
sleep(1)
|
|
lcd.display_off()
|
|
sleep(1)
|
|
lcd.display_on()
|
|
sleep(1)
|
|
lcd.clear()
|
|
sleep(1)
|
|
|
|
s = ""
|
|
for x in range(32, 127):
|
|
s += chr(x)
|
|
while len(s) > 0:
|
|
lcd.clear()
|
|
lcd.move_to(0,0)
|
|
lcd.putstr(s[:32])
|
|
s = s[32:]
|
|
sleep(1)
|
|
lcd.clear()
|
|
return True
|
|
|
|
if __name__ == "__main__":
|
|
import utils
|
|
run(utils.Config().LCD) |