Skip to content

Commit a58cf68

Browse files
authored
Merge pull request #4 from sparkfun/v0.0.2
V0.0.2
2 parents 594e4d9 + 0bb18cc commit a58cf68

10 files changed

+52
-45
lines changed

examples/qwiic_alphanumeric_ex01_print_string.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python
22
# ----------------------------------------------------------------------
3-
# qwiic_alphanumeric_ex4_print_string.py
3+
# qwiic_alphanumeric_ex1_print_string.py
44
#
55
# This example shows how to use the print() function to illuminate strings
66
# on the alphanumeric display.
@@ -38,7 +38,7 @@
3838
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3939
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4040
#=======================================================================
41-
# Example 4
41+
# Example 1
4242

4343
from __future__ import print_function
4444
import qwiic_alphanumeric
@@ -47,7 +47,7 @@
4747

4848
def run_example():
4949

50-
print("\nSparkFun Qwiic Alphanumeric - Example 4: Print String")
50+
print("\nSparkFun Qwiic Alphanumeric - Example 1: Print String")
5151
my_display = qwiic_alphanumeric.QwiicAlphanumeric()
5252

5353
if my_display.begin() == False:
@@ -63,5 +63,5 @@ def run_example():
6363
try:
6464
run_example()
6565
except (KeyboardInterrupt, SystemExit) as exErr:
66-
print("\nEnding Example 4")
66+
print("\nEnding Example 1")
6767
sys.exit(0)

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: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python
22
# ----------------------------------------------------------------------
3-
# qwiic_alphanumeric_ex5_set_brightness.py
3+
# qwiic_alphanumeric_ex4_set_brightness.py
44
#
55
# This example sets the brightness of the Qwiic Alphanumeric display.
66
# ----------------------------------------------------------------------
@@ -37,7 +37,7 @@
3737
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3838
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3939
#=======================================================================
40-
# Example 5
40+
# Example 4
4141

4242
from __future__ import print_function
4343
import qwiic_alphanumeric
@@ -46,7 +46,7 @@
4646

4747
def run_example():
4848

49-
print("\nSparkFun Qwiic Alphanumeric - Example 5: Set Brightness")
49+
print("\nSparkFun Qwiic Alphanumeric - Example 4: Set Brightness")
5050
my_display = qwiic_alphanumeric.QwiicAlphanumeric()
5151

5252
if my_display.begin() == False:
@@ -56,18 +56,21 @@ 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
62-
# So, the acceptable inputs to this function are ints between 0 (display off)
63-
# and 15 (full brightness)
66+
# So, the acceptable inputs to this function are ints between 0
67+
# (1/16 brightness) and 15 (full brightness)
6468
my_display.set_brightness(i)
65-
my_display.display_print("Milk")
66-
time.sleep(1)
69+
time.sleep(0.1)
6770

6871
if __name__ == '__main__':
6972
try:
7073
run_example()
7174
except (KeyboardInterrupt, SystemExit) as exErr:
72-
print("\nEnding Example 5")
75+
print("\nEnding Example 4")
7376
sys.exit(0)

examples/qwiic_alphanumeric_ex05_set_blink_rate.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python
22
# ----------------------------------------------------------------------
3-
# qwiic_alphanumeric_ex6_set_blink_rate.py
3+
# qwiic_alphanumeric_ex5_set_blink_rate.py
44
#
55
# This example sets the blink rate of the display.
66
# ----------------------------------------------------------------------
@@ -37,7 +37,7 @@
3737
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3838
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3939
#=======================================================================
40-
# Example 6
40+
# Example 5
4141

4242
from __future__ import print_function
4343
import qwiic_alphanumeric
@@ -46,7 +46,7 @@
4646

4747
def run_example():
4848

49-
print("\nSparkFun Qwiic Alphanumeric - Example 6: Set Blink Rate")
49+
print("\nSparkFun Qwiic Alphanumeric - Example 5: Set Blink Rate")
5050
my_display = qwiic_alphanumeric.QwiicAlphanumeric()
5151

5252
if my_display.begin() == False:
@@ -66,5 +66,5 @@ def run_example():
6666
try:
6767
run_example()
6868
except (KeyboardInterrupt, SystemExit) as exErr:
69-
print("\nEnding Example 6")
69+
print("\nEnding Example 5")
7070
sys.exit(0)

examples/qwiic_alphanumeric_ex06_colon_and_decimal.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python
22
# ----------------------------------------------------------------------
3-
# qwiic_alphanumeric_ex7_colon_and_decimal .py
3+
# qwiic_alphanumeric_ex6_colon_and_decimal .py
44
#
55
# This example tests the library's response to printing colons or decimal points.
66
# ----------------------------------------------------------------------
@@ -37,7 +37,7 @@
3737
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3838
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3939
#=======================================================================
40-
# Example 7
40+
# Example 6
4141

4242
from __future__ import print_function
4343
import qwiic_alphanumeric
@@ -46,7 +46,7 @@
4646

4747
def run_example():
4848

49-
print("\nSparkFun Qwiic Alphanumeric - Example 7: Colon and Decimal")
49+
print("\nSparkFun Qwiic Alphanumeric - Example 6: Colon and Decimal")
5050
my_display = qwiic_alphanumeric.QwiicAlphanumeric()
5151

5252
if my_display.begin() == False:
@@ -74,5 +74,5 @@ def run_example():
7474
try:
7575
run_example()
7676
except (KeyboardInterrupt, SystemExit) as exErr:
77-
print("\nEnding Example 7")
77+
print("\nEnding Example 6")
7878
sys.exit(0)

examples/qwiic_alphanumeric_ex07_unknown_char.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python
22
# ----------------------------------------------------------------------
3-
# qwiic_alphanumeric_ex8_unknown_char.py
3+
# qwiic_alphanumeric_ex7_unknown_char.py
44
#
55
# This example demonstrates what the library does when the user tries to
66
# print an unknown character.
@@ -38,7 +38,7 @@
3838
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3939
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4040
#=======================================================================
41-
# Example 8
41+
# Example 7
4242

4343
from __future__ import print_function
4444
import qwiic_alphanumeric
@@ -47,7 +47,7 @@
4747

4848
def run_example():
4949

50-
print("\nSparkFun Qwiic Alphanumeric - Example 8: Unkown Char")
50+
print("\nSparkFun Qwiic Alphanumeric - Example 7: Unkown Char")
5151
my_display = qwiic_alphanumeric.QwiicAlphanumeric()
5252

5353
if my_display.begin() == False:
@@ -65,5 +65,5 @@ def run_example():
6565
try:
6666
run_example()
6767
except (KeyboardInterrupt, SystemExit) as exErr:
68-
print("\nEnding Example 8")
68+
print("\nEnding Example 7")
6969
sys.exit(0)

examples/qwiic_alphanumeric_ex08_multi_display.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python
22
# ----------------------------------------------------------------------
3-
# qwiic_alphanumeric_ex9_multi_display.py
3+
# qwiic_alphanumeric_ex8_multi_display.py
44
#
55
# This example demonstrates how to connect multiple displays to the bus
66
# to print longer strings.
@@ -38,7 +38,7 @@
3838
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3939
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
4040
#=======================================================================
41-
# Example 9
41+
# Example 8
4242

4343
from __future__ import print_function
4444
import qwiic_alphanumeric
@@ -47,7 +47,7 @@
4747

4848
def run_example():
4949

50-
print("\nSparkFun Qwiic Alphanumeric - Example 9: Multi Display")
50+
print("\nSparkFun Qwiic Alphanumeric - Example 8: Multi Display")
5151
my_display = qwiic_alphanumeric.QwiicAlphanumeric()
5252

5353
if my_display.begin(0x70, 0x71) == False:
@@ -63,5 +63,5 @@ def run_example():
6363
try:
6464
run_example()
6565
except (KeyboardInterrupt, SystemExit) as exErr:
66-
print("\nEnding Example 9")
66+
print("\nEnding Example 8")
6767
sys.exit(0)

examples/qwiic_alphanumeric_ex09_scrolling_string.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# !/usr/bin/env python
22
# ----------------------------------------------------------------------
3-
# qwiic_alphanumeric_ex10_scrolling_string.py
3+
# qwiic_alphanumeric_ex9_scrolling_string.py
44
#
55
# This example tests the scrolling functionality of the display.
66
# ----------------------------------------------------------------------
@@ -37,7 +37,7 @@
3737
# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
3838
# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
3939
#=======================================================================
40-
# Example 10
40+
# Example 9
4141

4242
from __future__ import print_function
4343
import qwiic_alphanumeric
@@ -46,7 +46,7 @@
4646

4747
def run_example():
4848

49-
print("\nSparkFun Qwiic Alphanumeric - Example 10: Scrolling String")
49+
print("\nSparkFun Qwiic Alphanumeric - Example 9: Scrolling String")
5050
my_display = qwiic_alphanumeric.QwiicAlphanumeric()
5151

5252
if my_display.begin(0x70, 0x71) == False:
@@ -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
@@ -68,5 +69,5 @@ def run_example():
6869
try:
6970
run_example()
7071
except (KeyboardInterrupt, SystemExit) as exErr:
71-
print("\nEnding Example 10")
72+
print("\nEnding Example 9")
7273
sys.exit(0)

qwiic_alphanumeric.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -476,7 +476,7 @@ def set_brightness(self, duty):
476476
This function sets the brightness of all displays on the bus.
477477
Duty cycle over 16.
478478
479-
:param duty: Valid between 0 (display off) and 15 (full brightness)
479+
:param duty: Valid between 0 (1/16 brightnss) and 15 (full brightness)
480480
:return: True if brightness is successfully updated, false otherwise.
481481
:rtype: bool
482482
"""

setup.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
# Versions should comply with PEP440. For a discussion on single-sourcing
5353
# the version across setup.py and the project code, see
5454
# http://packaging.python.org/en/latest/tutorial.html#version
55-
version='0.0.1',
55+
version='0.0.2',
5656

5757
description='SparkFun Electronics qwiic alphanumeric package',
5858
long_description=long_description,

0 commit comments

Comments
 (0)