Skip to content

Commit 660dcc5

Browse files
Fixed lcd.message() in CharLCDPlate for non-string types
1 parent b1afed2 commit 660dcc5

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

Adafruit_CharLCDPlate/Adafruit_CharLCDPlate.py

+5-5
Original file line numberDiff line numberDiff line change
@@ -406,11 +406,11 @@ def createChar(self, location, bitmap):
406406

407407
def message(self, text):
408408
""" Send string to LCD. Newline wraps to second line"""
409-
lines = text.split('\n') # Split at newline(s)
410-
for line in lines: # Render each substring...
411-
self.write(line, True)
412-
if len(lines) > 1: # If newline(s),
413-
self.write(0xC0) # set DDRAM address to second line
409+
lines = str(text).split('\n') # Split at newline(s)
410+
for i, line in enumerate(lines): # For each substring...
411+
if i > 0: # If newline(s),
412+
self.write(0xC0) # set DDRAM address to 2nd line
413+
self.write(line, True) # Issue substring
414414

415415

416416
def backlight(self, color):

0 commit comments

Comments
 (0)