Skip to content

Commit af2d04b

Browse files
authored
Create 4bitExample.py
1 parent 8d2d2bc commit af2d04b

1 file changed

Lines changed: 20 additions & 0 deletions

File tree

Examples/4bitExample.py

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
from CharPi import HD44780_4bitDriver
2+
3+
display = HD44780_4bitDriver(25, 24, (23, 17, 27, 22), lines=4, columns=20) # 4 rows, 20 colums display, with specified pins (more details below)
4+
display.writeString("Hello, World!", delay = 0.1, newlineDelay = 0.3) # write a string with the specified delays.
5+
display.writeString("I'm using a HD44780 display!", lineNum = 2, columnNum = 0) # write a string, starting at the specified coordinates
6+
7+
# Useful to know:
8+
9+
# 1) writeString() automatically writes on the next line when needed, unless the disableAutoNewline argument is set to True.
10+
# Example: display.writeString("No Automatic Newline", disableAutoNewline=True) # automatic newline is disabled.
11+
12+
# 2) On some displays, when automatic newline is disabled, you might notice the letters appear on another line (not necessarily the next one)
13+
# when writing strings beyond the current line's maximum character limit. This is normal behaivour, caused by the display's memory
14+
# being assigned in that order.
15+
16+
# 3) Coordinates (row number and column number) start at 0.
17+
18+
# 4) You can change your display's pins:
19+
# display.HD44780_4bitDriver(RS_Pin, EN_Pin, (D4, D5, D6, D7), lines=4, columns=20)
20+
# Note: you must provide all your pin BCM IDs

0 commit comments

Comments
 (0)