|
12 | 12 |
|
13 | 13 | from time import sleep
|
14 | 14 | from Adafruit_CharLCDPlate import Adafruit_CharLCDPlate
|
15 |
| -from EoL_HandlingAnd4LineSupport import LCD_EoL_Handling |
| 15 | +from LCD_EoL_HandlingAnd4LineSupport import LCD_EoL_Handling |
16 | 16 |
|
17 | 17 | lcd = Adafruit_CharLCDPlate()
|
18 | 18 | eol = LCD_EoL_Handling()
|
|
29 | 29 | while True:
|
30 | 30 | #Text on each line alone.
|
31 | 31 | lcd.clear()
|
| 32 | + lcd.setCursor(0,0) |
32 | 33 | eol.message("Line 1")
|
33 | 34 | sleep(1)
|
34 | 35 |
|
|
47 | 48 | eol.message("Line 4")
|
48 | 49 | sleep(1)
|
49 | 50 |
|
| 51 | + # Using the "\n" new line marker |
50 | 52 | lcd.clear()
|
| 53 | + lcd.setCursor(0,0) |
51 | 54 | eol.message("Line 1")
|
52 | 55 | sleep(1)
|
53 | 56 |
|
54 |
| - # Using the "\n" new line marker |
55 | 57 | lcd.clear()
|
| 58 | + lcd.setCursor(0,0) |
56 | 59 | eol.message("Line 1\nLine 2")
|
57 | 60 | sleep(1)
|
58 | 61 |
|
59 | 62 | lcd.clear()
|
| 63 | + lcd.setCursor(0,0) |
60 | 64 | eol.message("Line 1\nLine 2\nLine 3")
|
61 | 65 | sleep(1)
|
62 | 66 |
|
63 | 67 | lcd.clear()
|
| 68 | + lcd.setCursor(0,0) |
64 | 69 | eol.message("Line 1\nLine 2\nLine 3\nLine 4")
|
65 | 70 | sleep(1)
|
66 | 71 |
|
67 | 72 | # Auto line limiting by length as to not overflow the display
|
68 | 73 | # This is line by line and does not to any caraige returns
|
69 | 74 | lcd.clear()
|
| 75 | + lcd.setCursor(0,0) |
70 | 76 | eol.message("This String is 33 Characters long",1)
|
71 | 77 | sleep(2)
|
72 | 78 |
|
73 | 79 | lcd.clear()
|
| 80 | + lcd.setCursor(0,0) |
74 | 81 | eol.message("This String has elpise",2)
|
75 | 82 | sleep(2)
|
76 | 83 |
|
|
79 | 86 | i=0
|
80 | 87 | while i<20:
|
81 | 88 | lcd.clear()
|
| 89 | + lcd.setCursor(0,0) |
82 | 90 | suffix = " " * i
|
83 | 91 | eol.message(suffix + messageToPrint,0)
|
84 | 92 | sleep(.25)
|
|
89 | 97 | i=20
|
90 | 98 | while i>=0:
|
91 | 99 | lcd.clear()
|
| 100 | + lcd.setCursor(0,0) |
92 | 101 | suffix = " " * i
|
93 | 102 | eol.message(suffix + messageToPrint,0)
|
94 | 103 | sleep(.25)
|
|
97 | 106 |
|
98 | 107 | # Printing text backwards, NOT right justified
|
99 | 108 | lcd.clear()
|
| 109 | + lcd.setCursor(0,0) |
100 | 110 | eol.message("Right to left:")
|
101 | 111 | lcd.setCursor(10,1)
|
102 | 112 | lcd.rightToLeft()
|
|
105 | 115 |
|
106 | 116 | # Printing normally from the middle of the line
|
107 | 117 | lcd.clear()
|
| 118 | + lcd.setCursor(0,0) |
108 | 119 | eol.message("Left to Right:")
|
109 | 120 | lcd.setCursor(10,1)
|
110 | 121 | lcd.message("Testing")
|
111 | 122 | sleep(2)
|
112 | 123 |
|
113 | 124 | # Enabling the cursor and having it blink
|
114 | 125 | lcd.clear()
|
| 126 | + lcd.setCursor(0,0) |
115 | 127 | lcd.cursor()
|
116 | 128 | lcd.blink()
|
117 | 129 | eol.message("Cursor is blinking")
|
|
122 | 134 |
|
123 | 135 | # Turning the backlight off and showing a simple count down
|
124 | 136 | lcd.clear()
|
| 137 | + lcd.setCursor(0,0) |
125 | 138 | eol.message("Backlight off in")
|
126 | 139 | lcd.setCursor(0,3)
|
127 | 140 | eol.message("Back on in 3sec")
|
|
139 | 152 |
|
140 | 153 | lcd.backlight(lcd.OFF)
|
141 | 154 | lcd.clear()
|
| 155 | + lcd.setCursor(0,0) |
142 | 156 | sleep(3)
|
143 | 157 | lcd.backlight(lcd.ON)
|
144 | 158 | eol.message("Backlight on")
|
0 commit comments