1# !/usr/bin/env python
2# ----------------------------------------------------------------------
3# qwiic_alphanumeric_ex9_multi_display.py
4#
5# This example demonstrates how to connect multiple displays to the bus
6# to print longer strings.
7# ----------------------------------------------------------------------
8#
9# Written by Priyanka Makin @ SparkFun Electronics, September 2021
10#
11# This python library supports the SparkFun Electronics qwiic sensor/
12# board ecosystem on a Raspberry Pi (and compatable) single board
13# computers.
14#
15# More information on qwiic is at https://www.sparkfun.com/qwiic
16#
17# Do you like this library? Help support SparkFun by buying a board!
18#
19# ======================================================================
20# Copyright (c) 2021 SparkFun Electronics
21#
22# Permission is hereby granted, free of charge, to any person obtaining
23# a copy of this software and associated documentation files (the
24# "Software"), to deal in the Software without restriction, including
25# without limitation the rights to use, copy, modify, merge, publish,
26# distribute, sublicense, and/or sell copies of the Software, and to
27# permit persons to whom the Software is furnished to do so, subject to
28# the following conditions:
29#
30# The above copyright notice and this permission notice shall be
31# included in all copies or substantial portions of the Software.
32#
33# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
34# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
35# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
36# IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
37# CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
38# TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
39# SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
40#=======================================================================
41# Example 9
42
43from __future__ import print_function
44import qwiic_alphanumeric
45import time
46import sys
47
48def run_example():
49
50 print("\nSparkFun Qwiic Alphanumeric - Example 9: Multi Display")
51 my_display = qwiic_alphanumeric.QwiicAlphanumeric()
52
53 if my_display.begin(0x70, 0x71) == False:
54 print("\nThe Qwiic Alhanumerics aren't connected to the system. Please check your connection", \
55 file=sys.stderr)
56 return
57
58 print("\nQwiic Alphanumerics ready!")
59
60 my_display.print("Get Milk")
61
62if __name__ == '__main__':
63 try:
64 run_example()
65 except (KeyboardInterrupt, SystemExit) as exErr:
66 print("\nEnding Example 9")
67 sys.exit(0)