File tree Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Expand file tree Collapse file tree 2 files changed +43
-0
lines changed Original file line number Diff line number Diff line change
1
+ # Driver for character-based LCD displays
2
+
3
+ This driver is for displays based on the Hitachi HD44780 driver: these are
4
+ widely available, typically in 16 character x 2 rows format.
5
+
6
+ # Files
7
+
8
+ * ` alcd.py ` Driver, includes connection details.
9
+ * ` alcdtest.py ` Test/demo script.
10
+
11
+ Currently most of the documentation, including wiring details, is in the code.
12
+
13
+ # Display Formatting
14
+
15
+ The driver represents an LCD display as an array indexed by row. Assigning a
16
+ string to a row causes that row to be updated. To write text to a specific
17
+ column of the display it is recommended to use the Python string ` format `
18
+ method.
19
+
20
+ For exampls this function formats a string such that it is left-padded with
21
+ spaces to a given column and right-padded to the specified width (typically the
22
+ width of the display). This ensures previous contents are overwritten.
23
+
24
+ ``` python
25
+ def print_at (st , col , width = 16 ):
26
+ return ' {: >{col}s}{: {t}s} ' .format(st,' ' , col = col+ len (st), t = width- (col+ len (st)))
27
+ ```
28
+
29
+ ```
30
+ >>> print_at('cat', 2)
31
+ ' cat '
32
+ >>> len(_)
33
+ 16
34
+ >>>
35
+ ```
36
+
37
+ Similar use of the ` format ` method can be used to achieve more complex
38
+ tabulated data layouts.
Original file line number Diff line number Diff line change @@ -13,6 +13,11 @@ This GitHub repository consists of the following parts:
13
13
* [ A driver for the HTU21D] ( ./htu21d/README.md ) temperature and humidity
14
14
sensor. This is intended to be portable across platforms and is another
15
15
example of an asynchronous device driver.
16
+ * [ A driver for character LCD displays] ( ./HD44780/README.md ) . A simple
17
+ asynchronous interface to displays based on the Hitachi HD44780 chip.
18
+ * [ A driver for GPS modules] ( ./gps/README.md ) Runs a background task to read
19
+ and decode NMEA sentences, providing constantly updated position, course,
20
+ altitude and time/date information.
16
21
* [ A modified uasyncio] ( ./FASTPOLL.md ) This incorporates a simple priority
17
22
mechanism. With suitable application design this improves the rate at which
18
23
devices can be polled and improves the accuracy of time delays. Also provides
You can’t perform that action at this time.
0 commit comments