Skip to content

Commit e03c818

Browse files
author
Pete Lewis
committed
ex14 working
1 parent 96f715f commit e03c818

File tree

2 files changed

+83
-3
lines changed

2 files changed

+83
-3
lines changed

examples/ex13_qwiic_serlcd_fast_backlight.py

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

0 commit comments

Comments
 (0)