Skip to content
This repository was archived by the owner on Sep 30, 2019. It is now read-only.

Commit 4728d9b

Browse files
committed
Update LCD_examples_w4LineSupport.py
Have to set the cursor back to 0,0 after a clear for some reason... will look into it more soon.
1 parent 5dd7a14 commit 4728d9b

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

Adafruit_CharLCDPlate/LCD_examples_w4LineSupport.py

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212

1313
from time import sleep
1414
from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
15-
from EoL_HandlingAnd4LineSupport import LCD_EoL_Handling
15+
from LCD_EoL_HandlingAnd4LineSupport import LCD_EoL_Handling
1616

1717
lcd = Adafruit_CharLCDPlate()
1818
eol = LCD_EoL_Handling()
@@ -29,6 +29,7 @@
2929
while True:
3030
#Text on each line alone.
3131
lcd.clear()
32+
lcd.setCursor(0,0)
3233
eol.message("Line 1")
3334
sleep(1)
3435

@@ -47,30 +48,36 @@
4748
eol.message("Line 4")
4849
sleep(1)
4950

51+
# Using the "\n" new line marker
5052
lcd.clear()
53+
lcd.setCursor(0,0)
5154
eol.message("Line 1")
5255
sleep(1)
5356

54-
# Using the "\n" new line marker
5557
lcd.clear()
58+
lcd.setCursor(0,0)
5659
eol.message("Line 1\nLine 2")
5760
sleep(1)
5861

5962
lcd.clear()
63+
lcd.setCursor(0,0)
6064
eol.message("Line 1\nLine 2\nLine 3")
6165
sleep(1)
6266

6367
lcd.clear()
68+
lcd.setCursor(0,0)
6469
eol.message("Line 1\nLine 2\nLine 3\nLine 4")
6570
sleep(1)
6671

6772
# Auto line limiting by length as to not overflow the display
6873
# This is line by line and does not to any caraige returns
6974
lcd.clear()
75+
lcd.setCursor(0,0)
7076
eol.message("This String is 33 Characters long",1)
7177
sleep(2)
7278

7379
lcd.clear()
80+
lcd.setCursor(0,0)
7481
eol.message("This String has elpise",2)
7582
sleep(2)
7683

@@ -79,6 +86,7 @@
7986
i=0
8087
while i<20:
8188
lcd.clear()
89+
lcd.setCursor(0,0)
8290
suffix = " " * i
8391
eol.message(suffix + messageToPrint,0)
8492
sleep(.25)
@@ -89,6 +97,7 @@
8997
i=20
9098
while i>=0:
9199
lcd.clear()
100+
lcd.setCursor(0,0)
92101
suffix = " " * i
93102
eol.message(suffix + messageToPrint,0)
94103
sleep(.25)
@@ -97,6 +106,7 @@
97106

98107
# Printing text backwards, NOT right justified
99108
lcd.clear()
109+
lcd.setCursor(0,0)
100110
eol.message("Right to left:")
101111
lcd.setCursor(10,1)
102112
lcd.rightToLeft()
@@ -105,13 +115,15 @@
105115

106116
# Printing normally from the middle of the line
107117
lcd.clear()
118+
lcd.setCursor(0,0)
108119
eol.message("Left to Right:")
109120
lcd.setCursor(10,1)
110121
lcd.message("Testing")
111122
sleep(2)
112123

113124
# Enabling the cursor and having it blink
114125
lcd.clear()
126+
lcd.setCursor(0,0)
115127
lcd.cursor()
116128
lcd.blink()
117129
eol.message("Cursor is blinking")
@@ -122,6 +134,7 @@
122134

123135
# Turning the backlight off and showing a simple count down
124136
lcd.clear()
137+
lcd.setCursor(0,0)
125138
eol.message("Backlight off in")
126139
lcd.setCursor(0,3)
127140
eol.message("Back on in 3sec")
@@ -139,6 +152,7 @@
139152

140153
lcd.backlight(lcd.OFF)
141154
lcd.clear()
155+
lcd.setCursor(0,0)
142156
sleep(3)
143157
lcd.backlight(lcd.ON)
144158
eol.message("Backlight on")

0 commit comments

Comments
 (0)