|
1 | | -# Qwiic_SerLCD_Py |
2 | | -Python module for I2C control of the SparkFun Qwiic Serial LCDs |
| 1 | +Qwiic_SerLCD_Py |
| 2 | +============== |
| 3 | + |
| 4 | +<p align="center"> |
| 5 | + <img src="https://cdn.sparkfun.com/assets/custom_pages/2/7/2/qwiic-logo-registered.jpg" width=200> |
| 6 | + <img src="https://www.python.org/static/community_logos/python-logo-master-v3-TM.png" width=240> |
| 7 | +</p> |
| 8 | +<p align="center"> |
| 9 | + <a href="https://pypi.org/project/sparkfun-qwiic-serlcd/" alt="Package"> |
| 10 | + <img src="https://img.shields.io/pypi/pyversions/sparkfun_qwiic_serlcd.svg" /></a> |
| 11 | + <a href="https://github.com/sparkfun/Qwiic_SerLCD_Py/issues" alt="Issues"> |
| 12 | + <img src="https://img.shields.io/github/issues/sparkfun/Qwiic_SerLCD_Py.svg" /></a> |
| 13 | + <a href="https://qwiic-serlcd-py.readthedocs.io/en/latest/" alt="Documentation"> |
| 14 | + <img src="https://readthedocs.org/projects/qwiic-serlcd-py/badge/?version=latest&style=flat" /></a> |
| 15 | + <a href="https://github.com/sparkfun/Qwiic_SerLCD_Py/blob/master/LICENSE" alt="License"> |
| 16 | + <img src="https://img.shields.io/badge/license-MIT-blue.svg" /></a> |
| 17 | + <a href="https://twitter.com/intent/follow?screen_name=sparkfun"> |
| 18 | + <img src="https://img.shields.io/twitter/follow/sparkfun.svg?style=social&logo=twitter" |
| 19 | + alt="follow on Twitter"></a> |
| 20 | +</p> |
| 21 | + |
| 22 | +<table class="table table-hover table-striped table-bordered"> |
| 23 | + <tr align="center"> |
| 24 | + <td><a href="https://www.sparkfun.com/products/16396"><img src="https://cdn.sparkfun.com//assets/parts/1/1/9/2/5/14072-SparkFun_16x2_SerLCD_-_Black_on_RGB_3.3V-04.jpg" title="SparkFun SerLCD 16x2 - RGB Backlight (QWIIC)"></a></td> |
| 25 | + <td><a href="https://www.sparkfun.com/products/16397"><img src="https://cdn.sparkfun.com//assets/parts/1/1/9/2/5/14072-SparkFun_16x2_SerLCD_-_Black_on_RGB_3.3V-04.jpg" title="SparkFun SerLCD 16x2 - RGB Text (QWIIC)"></a></td> |
| 26 | + <td><a href="https://www.sparkfun.com/products/16398"><img src="https://cdn.sparkfun.com//assets/parts/1/1/9/2/5/14072-SparkFun_16x2_SerLCD_-_Black_on_RGB_3.3V-04.jpg" title="SparkFun SerLCD 20x2 - RGB Backlight (QWIIC)"></a></td> |
| 27 | + </tr> |
| 28 | + <tr align="center"> |
| 29 | + <td><i><a href="https://www.sparkfun.com/products/16396">SparkFun SerLCD 16x2 - RGB Backlight (QWIIC)</a></i></td> |
| 30 | + <td><i><a href="https://www.sparkfun.com/products/16397">SparkFun SerLCD 16x2 - RGB Text (QWIIC)</a></i></td> |
| 31 | + <td><i><a href="https://www.sparkfun.com/products/16398">SparkFun SerLCD 20x2 - RGB Backlight (QWIIC)</a></i></td> |
| 32 | + </tr> |
| 33 | +</table> |
| 34 | + |
| 35 | +Python module for I2C control of the SparkFun Qwiic Serial LCDs. |
| 36 | + |
| 37 | +This package enables the user to access all of the features of these LCD products via a single Qwiic cable. This includes writing text to the screen, adjusting backlight levels (color), customizing splash screen and much much more. They come pre-programmed with the fully open-sourced [OpenLCD firmware](https://github.com/sparkfun/OpenLCD). All of the capabilities of these LCD screens are each demonstrated in the included 17 examples. |
| 38 | + |
| 39 | +This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py) |
| 40 | + |
| 41 | +New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic). |
| 42 | + |
| 43 | +## Contents |
| 44 | + |
| 45 | +* [Supported Platforms](#supported-platforms) |
| 46 | +* [Dependencies](#dependencies) |
| 47 | +* [Installation](#installation) |
| 48 | +* [Documentation](#documentation) |
| 49 | +* [Example Use](#example-use) |
| 50 | + |
| 51 | +Supported Platforms |
| 52 | +-------------------- |
| 53 | +The qwiic serlcd python package current supports the following platforms: |
| 54 | +* [Raspberry Pi](https://www.sparkfun.com/search/results?term=raspberry+pi) |
| 55 | +* [NVidia Jetson Nano](https://www.sparkfun.com/products/15297) |
| 56 | +* [Google Coral Development Board](https://www.sparkfun.com/products/15318) |
| 57 | + |
| 58 | +Dependencies |
| 59 | +--------------- |
| 60 | +This driver package depends on the qwiic I2C driver: |
| 61 | +[Qwiic_I2C_Py](https://github.com/sparkfun/Qwiic_I2C_Py) |
| 62 | + |
| 63 | +Documentation |
| 64 | +------------- |
| 65 | +The SparkFun qwiic serlcd documentation is hosted at [ReadTheDocs](https://qwiic-serlcd-py.readthedocs.io/en/latest/) |
| 66 | + |
| 67 | +Installation |
| 68 | +------------- |
| 69 | + |
| 70 | +### PyPi Installation |
| 71 | +This repository is hosted on PyPi as the [sparkfun-qwiic-serlcd](https://pypi.org/project/sparkfun-qwiic-serlcd/) package. On systems that support PyPi installation via pip, this library is installed using the following commands |
| 72 | + |
| 73 | +For all users (note: the user must have sudo privileges): |
| 74 | +```sh |
| 75 | +sudo pip install sparkfun-qwiic-serlcd |
| 76 | +``` |
| 77 | +For the current user: |
| 78 | + |
| 79 | +```sh |
| 80 | +pip install sparkfun-qwiic-serlcd |
| 81 | +``` |
| 82 | + |
| 83 | +### Local Installation |
| 84 | +To install, make sure the setuptools package is installed on the system. |
| 85 | + |
| 86 | +Direct installation at the command line: |
| 87 | +```sh |
| 88 | +python setup.py install |
| 89 | +``` |
| 90 | + |
| 91 | +To build a package for use with pip: |
| 92 | +```sh |
| 93 | +python setup.py sdist |
| 94 | + ``` |
| 95 | +A package file is built and placed in a subdirectory called dist. This package file can be installed using pip. |
| 96 | +```sh |
| 97 | +cd dist |
| 98 | +pip install sparkfun_qwiic_serlcd-<version>.tar.gz |
| 99 | + |
| 100 | +``` |
| 101 | +Example Use |
| 102 | + --------------- |
| 103 | +See the examples directory for more detailed use examples. |
| 104 | + |
| 105 | +```python |
| 106 | +from __future__ import print_function |
| 107 | +import qwiic_serlcd |
| 108 | +import time |
| 109 | +import sys |
| 110 | + |
| 111 | +def runExample(): |
| 112 | + |
| 113 | + print("\nSparkFun Qwiic SerLCD Example 1\n") |
| 114 | + myLCD = qwiic_serlcd.QwiicSerlcd() |
| 115 | + |
| 116 | + if myLCD.connected == False: |
| 117 | + print("The Qwiic SerLCD device isn't connected to the system. Please check your connection", \ |
| 118 | + file=sys.stderr) |
| 119 | + return |
| 120 | + |
| 121 | + myLCD.setBacklight(255, 255, 255) # Set backlight to bright white |
| 122 | + myLCD.setContrast(5) # set contrast. Lower to 0 for higher contrast. |
| 123 | + myLCD.clearScreen() # clear the screen - this moves the cursor to the home position as well |
| 124 | + |
| 125 | + time.sleep(1) # give a sec for system messages to complete |
| 126 | + |
| 127 | + myLCD.print("Hello World!") |
| 128 | + counter = 0 |
| 129 | + while True: |
| 130 | + print("counter: %d" % counter) |
| 131 | + myLCD.setCursor(0,1) |
| 132 | + myLCD.print(str(counter)) |
| 133 | + counter = counter + 1 |
| 134 | + time.sleep(1) |
| 135 | + |
| 136 | +if __name__ == '__main__': |
| 137 | + try: |
| 138 | + runExample() |
| 139 | + except (KeyboardInterrupt, SystemExit) as exErr: |
| 140 | + print("\nEnding Example 1") |
| 141 | + sys.exit(0) |
| 142 | +``` |
| 143 | +<p align="center"> |
| 144 | +<img src="https://cdn.sparkfun.com/assets/custom_pages/3/3/4/dark-logo-red-flame.png" alt="SparkFun - Start Something"> |
| 145 | +</p> |
0 commit comments