|
40 | 40 | GREEN = [0, 100, 0]
|
41 | 41 | BLUE = [0, 0, 100]
|
42 | 42 |
|
43 |
| -lcd.clear() |
44 |
| -# Set LCD color to red |
45 |
| -lcd.color = [100, 0, 0] |
46 |
| -time.sleep(1) |
47 |
| -# Print two line message |
48 |
| -lcd.message = "Hello\nCircuitPython" |
49 |
| -# Wait 5s |
50 |
| -time.sleep(5) |
51 |
| -# Set LCD color to blue |
52 |
| -lcd.color = [0, 100, 0] |
53 |
| -time.sleep(1) |
54 |
| -# Set LCD color to green |
55 |
| -lcd.color = [0, 0, 100] |
56 |
| -time.sleep(1) |
57 |
| -# Set LCD color to purple |
58 |
| -lcd.color = [50, 0, 50] |
59 |
| -time.sleep(1) |
60 |
| -lcd.clear() |
61 |
| -# Print two line message right to left |
62 |
| -lcd.text_direction = lcd.RIGHT_TO_LEFT |
63 |
| -lcd.message = "Hello\nCircuitPython" |
64 |
| -# Wait 5s |
65 |
| -time.sleep(5) |
66 |
| -# Return text direction to left to right |
67 |
| -lcd.text_direction = lcd.LEFT_TO_RIGHT |
68 |
| -# Display cursor |
69 |
| -lcd.clear() |
70 |
| -lcd.cursor = True |
71 |
| -lcd.message = "Cursor! " |
72 |
| -# Wait 5s |
73 |
| -time.sleep(5) |
74 |
| -# Display blinking cursor |
75 |
| -lcd.clear() |
76 |
| -lcd.blink = True |
77 |
| -lcd.message = "Blinky Cursor!" |
78 |
| -# Wait 5s |
79 |
| -time.sleep(5) |
80 |
| -lcd.blink = False |
81 |
| -lcd.clear() |
82 |
| -# Create message to scroll |
83 |
| -scroll_msg = "<-- Scroll" |
84 |
| -lcd.message = scroll_msg |
85 |
| -# Scroll to the left |
86 |
| -for i in range(len(scroll_msg)): |
87 |
| - time.sleep(0.5) |
88 |
| - lcd.move_left() |
89 |
| -lcd.clear() |
90 |
| -time.sleep(1) |
91 |
| -lcd.message = "Going to sleep\nCya later!" |
92 |
| -time.sleep(5) |
93 |
| -# Turn off LCD backlights and clear text |
94 |
| -lcd.color = [0, 0, 0] |
95 |
| -lcd.clear() |
| 43 | +while True: |
| 44 | + lcd.clear() |
| 45 | + # Set LCD color to red |
| 46 | + lcd.color = [100, 0, 0] |
| 47 | + time.sleep(1) |
96 | 48 |
|
| 49 | + # Print two line message |
| 50 | + lcd.message = "Hello\nCircuitPython" |
| 51 | + |
| 52 | + # Wait 5s |
| 53 | + time.sleep(5) |
| 54 | + |
| 55 | + # Set LCD color to blue |
| 56 | + lcd.color = [0, 100, 0] |
| 57 | + time.sleep(1) |
| 58 | + # Set LCD color to green |
| 59 | + lcd.color = [0, 0, 100] |
| 60 | + time.sleep(1) |
| 61 | + # Set LCD color to purple |
| 62 | + lcd.color = [50, 0, 50] |
| 63 | + time.sleep(1) |
| 64 | + lcd.clear() |
| 65 | + |
| 66 | + # Print two line message right to left |
| 67 | + lcd.text_direction = lcd.RIGHT_TO_LEFT |
| 68 | + lcd.message = "Hello\nCircuitPython" |
| 69 | + # Wait 5s |
| 70 | + time.sleep(5) |
| 71 | + |
| 72 | + # Return text direction to left to right |
| 73 | + lcd.text_direction = lcd.LEFT_TO_RIGHT |
| 74 | + |
| 75 | + # Display cursor |
| 76 | + lcd.clear() |
| 77 | + lcd.cursor = True |
| 78 | + lcd.message = "Cursor! " |
| 79 | + # Wait 5s |
| 80 | + time.sleep(5) |
| 81 | + |
| 82 | + # Display blinking cursor |
| 83 | + lcd.clear() |
| 84 | + lcd.blink = True |
| 85 | + lcd.message = "Blinky Cursor!" |
| 86 | + # Wait 5s |
| 87 | + time.sleep(5) |
| 88 | + lcd.blink = False |
| 89 | + lcd.clear() |
| 90 | + |
| 91 | + # Create message to scroll |
| 92 | + scroll_msg = "<-- Scroll" |
| 93 | + lcd.message = scroll_msg |
| 94 | + # Scroll to the left |
| 95 | + for i in range(len(scroll_msg)): |
| 96 | + time.sleep(0.5) |
| 97 | + lcd.move_left() |
| 98 | + lcd.clear() |
| 99 | + |
| 100 | + # Turn off LCD backlights and clear text |
| 101 | + lcd.color = [0, 0, 0] |
| 102 | + lcd.clear() |
| 103 | + time.sleep(1) |
0 commit comments