Skip to content
Prev Previous commit
Next Next commit
Update charlcd_mono_simpletest.py
  • Loading branch information
profbrady authored Apr 10, 2019
commit 25161293a64870278ad4215730d5aef5e9fe64df
30 changes: 29 additions & 1 deletion examples/charlcd_mono_simpletest.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,14 +25,41 @@
lcd.backlight = True
# Print a two line message
lcd.message = "Hello\nCircuitPython"
# Wait 3s
time.sleep(3)
# Print two line message with cursor set to column 2
lcd.clear()
lcd.cursor_position(2,0)
lcd.message = "Hello\nCircuitPython"
# Wait 5s
time.sleep(5)
lcd.clear()
# Stars across the display one a time on second row from L to R
# using cursor_position
for i in range(16):
lcd.cursor_position(i,1)
lcd.message = "*"
time.sleep(0.1)
lcd.clear()
# Print two line message right to left
lcd.text_direction = lcd.RIGHT_TO_LEFT
lcd.message = "Hello\nCircuitPython"
# Wait 5s
time.sleep(5)
# Print two line R to L message with cursor set to column 3
lcd.clear()
lcd.text_direction = lcd.RIGHT_TO_LEFT
lcd.cursor_position(3,0)
lcd.message = "Hello\nCircuitPython"
# Wait 3s
time.sleep(3)
# Stars across the display one a time on second row from R to L
lcd.clear()
for i in range(16):
lcd.cursor_position(i,1)
lcd.message = "*"
time.sleep(0.1)
lcd.clear()
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's remove the lcd.clear() just to keep the examples consistent.

# Return text direction to left to right
lcd.text_direction = lcd.LEFT_TO_RIGHT
# Display cursor
Expand All @@ -50,10 +77,11 @@
lcd.blink = False
lcd.clear()
# Create message to scroll
lcd.cursor_position(5,0)
scroll_msg = '<-- Scroll'
lcd.message = scroll_msg
# Scroll message to the left
for i in range(len(scroll_msg)):
for i in range(len(scroll_msg)+5):
time.sleep(0.5)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks like there are still some changes to the simpletest, so just remove the +5

lcd.move_left()
lcd.clear()
Expand Down