Skip to content

Commit 77ac853

Browse files
committed
Tweak Examples 3, 4, and 9
Example 3 - Print all characters on each digit rapidly Example 4 - Cycle brightness a few times more rapidly, only print text once Example 9 - Only shift 8 times, not infinitely
1 parent 5b7425d commit 77ac853

File tree

3 files changed

+20
-13
lines changed

3 files changed

+20
-13
lines changed

examples/qwiic_alphanumeric_ex03_print_char.py

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -62,16 +62,19 @@ def run_example():
6262
my_display.print_char('T', 3)
6363

6464
my_display.update_display()
65+
66+
time.sleep(1)
6567

66-
# # Un comment these lines if you want to see all available characters
67-
# # Print to every digit of a given display
68-
# for digit_num in range(0, 4):
69-
# for i in range(ord(' '), ord('~')):
70-
# if i is not ord(':') or ord('.'):
71-
# my_display.print_char(chr(i), digit_num)
72-
# my_display.update_display()
73-
# time.sleep(1)
74-
# my_display.clear()
68+
# Display all available characters
69+
for i in range(ord(' '), ord('~')):
70+
if i is not ord(':') or ord('.'):
71+
my_display.print_char(chr(i), 0)
72+
my_display.print_char(chr(i), 1)
73+
my_display.print_char(chr(i), 2)
74+
my_display.print_char(chr(i), 3)
75+
my_display.update_display()
76+
time.sleep(0.1)
77+
my_display.clear()
7578

7679
if __name__ == '__main__':
7780
try:

examples/qwiic_alphanumeric_ex04_set_brightness.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -56,14 +56,17 @@ def run_example():
5656

5757
print("\nQwiic Alphanumeric Ready!")
5858

59-
while True:
59+
my_display.print("Milk")
60+
61+
# Repeat a few times
62+
for i in range(4):
63+
# Loop through all brightness settings
6064
for i in range(0, 16):
6165
# The input to set_brightness() is a duty cycle over 16
6266
# So, the acceptable inputs to this function are ints between 0
6367
# (1/16 brightness) and 15 (full brightness)
6468
my_display.set_brightness(i)
65-
time.sleep(1)
66-
my_display.print("Milk")
69+
time.sleep(0.1)
6770

6871
if __name__ == '__main__':
6972
try:

examples/qwiic_alphanumeric_ex09_scrolling_string.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,8 @@ def run_example():
5858

5959
my_display.print("GET MILK")
6060

61-
while 1:
61+
# Loop through all 8 characters
62+
for i in range(8):
6263
time.sleep(1)
6364
my_display.shift_left()
6465
# Alternatively - you could also shift the string to the right

0 commit comments

Comments
 (0)