8000 ex5 working, also debug ending corrected on others · sparkfun/qwiic_serlcd_py@d6b4117 · GitHub
[go: up one dir, main page]

Skip to content

Commit d6b4117

Browse files
author
Pete Lewis
committed
ex5 working, also debug ending corrected on others
1 parent dfad153 commit d6b4117

File tree

Expand file tree

4 files changed

+94
-3
lines changed

4 files changed

+94
-3
lines changed

examples/ex2_qwiic_serlcd_backlight.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ def runExample():
121121
try:
122122
runExample()
123123
except (KeyboardInterrupt, SystemExit) as exErr:
124-
print("\nEnding Example 1")
124+
print("\nEnding Example 2")
125125
sys.exit(0)
126126

127127

examples/ex3_qwiic_serlcd_set_cursor_position.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ def runExample():
9696
try:
9797
runExample()
9898
except (KeyboardInterrupt, SystemExit) as exErr:
99-
print("\nEnding Example 1")
99+
print("\nEnding Example 3")
100100
sys.exit(0)
101101

102102

examples/ex4_qwiic_serlcd_move_cursor.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ def runExample():
9898
try:
9999
runExample()
100100
except (KeyboardInterrupt, SystemExit) as exErr:
101-
print("\nEnding Example 1")
101+
print("\nEnding Example 4")
102102
sys.exit(0)
103103

104104

Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
#!/usr/bin/env python
2+
#-----------------------------------------------------------------------------
3+
# ex5_qwiic_serlcd_enable_cursor.py
4+
#
5+
# Simple Example demonstrating the enable and disable cursor controls on the SerLCD (Qwiic).
6+
#
7+
# This example prints "Hello World!" to the LCD and
8+
# uses the cursor() and noCursor() methods to turn
9+
# on and off the cursor.
10+
#------------ 10000 ------------------------------------------------------------
11+
#
12+
# Written by SparkFun Electronics, August 2020
13+
#
14+
# Ported from Arduino Library code with many contributions from
15+
# Gaston Williams - August 29, 2018
16+
#
17+
# This python library supports the SparkFun Electroncis qwiic
18+
# qwiic sensor/board ecosystem on a Raspberry Pi (and compatable) single
19+
# board computers.
20+
#
21+
# More information on qwiic is at https://www.sparkfun.com/qwiic
22+
#
23+
# Do you like this library? Help support SparkFun. Buy a board!
24+
#
25+
#==================================================================================
26+
# Copyright (c) 2020 SparkFun Electronics
27+
#
28+
# Permission is hereby granted, free of charge, to any person obtaining a copy
29+
# of this software and associated documentation files (the "Software"), to deal
30+
# in the Software without restriction, including without limitation the rights
31+
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
32+
# copies of the Software, and to permit persons to whom the Software is
33+
# furnished to do so, subject to the following conditions:
34+
#
35+
# The above copyright notice and this permission notice shall be included in all
36+
# copies or substantial portions of the Software.
37+
#
38+
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
39+
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
40+
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
41+
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
42+
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
43+
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
44+
# SOFTWARE.
45+
#==================================================================================
46+
# Example 5
47+
#
48+
49+
from __future__ import print_function
50+
import qwiic_serlcd
51+
import time
52+
import sys
53+
54+
def runExample():
55+
56+
print("\nSparkFun Qwiic SerLCD Example 5\n")
57+
myLCD = qwiic_serlcd.QwiicSerlcd()
58+
59+
if myLCD.connected == False:
60+
print("The Qwiic SerLCD device isn't connected to the system. Please check your connection", \
61+
file=sys.stderr)
62+
return
63+
64+
myLCD.setBacklight(255, 255, 255) # Set backlight to bright white
65+
myLCD.setContrast(5) # set contrast. Lower to 0 for higher contrast.
66+
myLCD.clearScreen()
67+
myLCD.cursor() # Turn on the underline cursor
68+
69+
time.sleep(1) # give a sec for system messages to complete
70+
myLCD.print("Hello World!")
71+
72+
while True:
73+
# turn off the cursor
74+
print("Cursor OFF")
75+
myLCD.noCursor()
76+
time.sleep(1)
77+
78+
# turn on the cursor
79+
print("Cursor ON")
80+
81+
myLCD.cursor()
82+
time.sleep(1)
83+
84+
if __name__ == '__main__':
85+
try:
86+
runExample()
87+
except (KeyboardInterrupt, SystemExit) as exErr:
88+
print("\nEnding Example 5")
89+
sys.exit(0)
90+
91+

0 commit comments

Comments
 (0)
0