You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Python module for the qwiic keypad, which is part of the [SparkFun Qwiic Keypad - 12 Button](https://www.sparkfun.com/products/15290)
11
+
The SparkFun Qwiic Keypad provides a simple and cost effective solution for adding button inputs to your project without tying up GPIO lines. Implementing a SparkFun Qwiic I2C interface, these sensors can be rapidly added to any project with boards that are part of the SparkFun Qwiic ecosystem.
12
+
13
+
This repository implements a Python package for the SparkFun Qwiic Keypad. This package works with Python, MicroPython and CircuitPython.
This python package is a port of the existing [SparkFun Qwiic Keypad Arduino Library](https://github.com/sparkfun/SparkFun_Qwiic_Keypad_Arduino_Library)
24
+
## About the Package
28
25
29
-
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
26
+
This python package enables the user to access the features of the Keypad via a single Qwiic cable. This includes reading keypresses, time of press, and more. The capabilities of the Keypad are each demonstrated in the included examples.
30
27
31
28
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
32
29
33
-
##Contents
30
+
### Supported SparkFun Products
34
31
35
-
*[Dependencies](#dependencies)
36
-
*[Installation](#installation)
37
-
*[Documentation](#documentation)
38
-
*[Example Use](#example-use)
32
+
This Python package supports the following SparkFun qwiic products on Python, MicroPython and Circuit python.
| Python | Linux |[Raspberry Pi](https://www.sparkfun.com/raspberry-pi-5-8gb.html) , [NVIDIA Jetson Orin Nano](https://www.sparkfun.com/nvidia-jetson-orin-nano-developer-kit.html) via the [SparkFun Qwiic SHIM](https://www.sparkfun.com/sparkfun-qwiic-shim-for-raspberry-pi.html)|
> The listed supported platforms and boards are the primary platform targets tested. It is fully expected that this package will work across a wide variety of Python enabled systems.
46
+
47
+
## Installation
48
+
49
+
The first step to using this package is installing it on your system. The install method depends on the python platform. The following sections outline installation on Python, MicroPython and CircuitPython.
39
50
40
-
Dependencies
41
-
---------------
42
-
This driver package depends on the qwiic I2C driver:
The SparkFun qwiic Keypad module documentation is hosted at [ReadTheDocs](https://qwiic-keypad-py.readthedocs.io/en/latest/?)
53
+
The package is primarily installed using the `pip` command, downloading the package from the Python Index - "PyPi". Note - the below instructions outline installation an Linux-based (Raspberry Pi) system.
48
54
49
-
Installation
50
-
-------------
55
+
#### PyPi Installation
51
56
52
-
### PyPi Installation
53
-
This repository is hosted on PyPi as the [sparkfun-qwiic-keypad](https://pypi.org/project/sparkfun-qwiic-keypad/) package. On systems that support PyPi installation via pip, this library is installed using the following commands
57
+
The SparkFun Qwiic Keypad Python package is part of the overall SparkFun Qwiic Python package which is hosted on PyPi. On systems that support PyPi installation via pip, this library is installed using the following commands
54
58
55
59
For all users (note: the user must have sudo privileges):
56
60
```sh
57
-
sudo pip install sparkfun-qwiic-keypad
61
+
sudo pip install sparkfun-qwiic
58
62
```
59
63
For the current user:
60
64
61
65
```sh
62
-
pip install sparkfun-qwiic-keypad
66
+
pip install sparkfun-qwiic
63
67
```
64
-
65
-
### Local Installation
68
+
---
69
+
---
70
+
> [!CAUTION]
71
+
> **TODO** Put together how this works with the new virtual environments used with the latest Python install
72
+
---
73
+
---
74
+
#### Local Installation
66
75
To install, make sure the setuptools package is installed on the system.
67
76
68
77
Direct installation at the command line:
@@ -78,11 +87,34 @@ A package file is built and placed in a subdirectory called dist. This package f
If not already installed, follow the [instructions here](https://docs.micropython.org/en/latest/reference/mpremote.html) to install mpremote on your computer.
94
+
95
+
Connect a device with MicroPython installed to your computer and then install the package directly to your device with mpremote mip.
If not already installed, follow the [instructions here](https://docs.circuitpython.org/projects/circup/en/latest/#installation) to install CircUp on your computer.
102
+
103
+
Ensure that you have the latest version of the SparkFun Qwiic CircuitPython bundle.
104
+
```sh
105
+
circup bundle-add sparkfun/Qwiic_Py
106
+
```
107
+
108
+
Finally, connect a device with CircuitPython installed to your computer and then install the package directly to your device with circup.
109
+
```sh
110
+
circup install --py qwiic_keypad
111
+
```
112
+
83
113
Example Use
84
114
---------------
85
-
See the examples directory for more detailed use examples.
115
+
Below is a quickstart program to print which button was pressed or a space if '*' is pressed and a newline if '#' is pressed.
116
+
117
+
See the examples directory for more detailed use examples and [examples/README.md](https://github.com/sparkfun/qwiic_keypad_py/blob/main/examples/README.md) for a summary of the available examples.
Below is a brief summary of each of the example programs included in this repository. To report a bug in any of these examples or to request a new feature or example [submit an issue in our GitHub issues.](https://github.com/sparkfun/qwiic_keypad_py/issues).
3
+
4
+
## Example 1: Basic Readings
5
+
This example demonstrates basic bringup of the Qwiic Keypad to print which button was pressed or a space if '*' is pressed and a newline if '#' is pressed
This example prints which button was pressed as well as the time of how long ago it was pressed.
13
+
14
+
The key method showcased by this example is [time_since_pressed()](https://docs.sparkfun.com/qwiic_keypad_py/classqwiic__keypad_1_1_qwiic_keypad.html#a58e82d1c12a242f7dfdcb57232365185)
15
+
16
+
## Example 3:
17
+
This example waits for the user to input the correct 4 digit keycode and responds with a nice message on serial if they get it right. It demonstrates how to ignore startup noise and then check user input against a stored keycode.
0 commit comments