"""
┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓
┃ Raspberry Pi Pico 1602 Display (MicroPython)┃
┃ ┃
┃ A program to demonstrate the use of a 1602 display ┃
┃ License: Appace ┃
┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛
"""
from machine import Pin
from utime import sleep
import time
time.sleep(0.1) # Wait for USB to become ready
print("Hello, Pi Pico!")
"""
Minimum for start:
1. Mode 0000 0100
2. Display 0000 1111
3. Clear 0000 0001
0000 0001 Clear
0000 0010 Home
0000 0100 - Mode
0000 1000 Display off, Cursor - off, Blink - off
0000 1111 Display -on, Cursor - on, Blink - on
0001 00xx Sift cursor left
0001 01xx Shift cursol right
0001 10xx Shift display left
0001 11xx Shift display right
0011 00xx 8bit mode, 1 line, 5x8 char
0010 11xx 4bit mode, 2 line, 5x10 char
"""
from gpio_lcd import GpioLcd
# Create the LCD object
lcd = GpioLcd(rs_pin=Pin(15),
enable_pin=Pin(14),
d4_pin=Pin(9),
d5_pin=Pin(8),
d6_pin=Pin(7),
d7_pin=Pin(6),
num_lines=2, num_columns=16)
while True:
lcd.move_to(0,0) ## Jump to 0, 0
lcd.putstr('Zeile 1') ## Print Message
lcd.move_to(0,1) ## Jump to 0, 1
lcd.putstr('Zeile 2')
# #The following line of codes should be tested one by one according to your needs
#1. To print a string to the LCD, you can use
# lcd.putstr('Beispiel')
#2. Now, to clear the display.
# lcd.clear()
#3. and to exactly position the cursor location
# lcd.move_to(0,1)
#4. Show the cursor
# lcd.show_cursor()
#5. Hide the cursor
# lcd.hide_cursor()
#6. Turn ON blinking cursor
# lcd.blink_cursor_on()
#7. Turn OFF blinking cursor
# lcd.blink_cursor_off()
#8. Disable display
# lcd.display_off()
# this will only hide the characters
#9. Enable display
# lcd.display_on()
#10. Turn backlight OFF
# lcd.backlight_off()
#11. Turn backlight ON
# lcd.backlight_on()
#12. Print a single character
# lcd.putchar('x')
# but this will only print 1 character
#13. Display a custom characters using hex codes, you can create the character from <a href="https://maxpromer.github.io/LCD-Character-Creator/">here.</a>
# happy_face = bytearray([0x00,0x0A,0x00,0x04,0x00,0x11,0x0E,0x00])
# lcd.custom_char(0, happy_face)
# lcd.putchar(chr(0))