Skip to content

Commit 3cfd494

Browse files
authored
Update README.md
1 parent 279753d commit 3cfd494

File tree

1 file changed

+130
-1
lines changed

1 file changed

+130
-1
lines changed

README.md

Lines changed: 130 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1,130 @@
1-
# Qwiic_Button_Py
1+
Qwiic_Button_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-button/" alt="Package">
10+
<img src="https://img.shields.io/pypi/pyversions/sparkfun-qwiic-button.svg" /></a>
11+
<a href="https://github.com/sparkfun/Qwiic_Button_Py/issues" alt="Issues">
12+
<img src="https://img.shields.io/github/issues/sparkfun/Qwiic_Button_Py.svg" /></a>
13+
<a href="https://qwiic-button-py.readthedocs.io/en/main/?" alt="Documentation">
14+
<img src="https://readthedocs.org/projects/qwiic-button-py/badge/?version=main&style=flat" /></a>
15+
<a href="https://github.com/sparkfun/Qwiic_Button_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+
21+
</p>
22+
23+
<img src="https://cdn.sparkfun.com/assets/parts/1/4/5/7/3/15932-SparkFun_Qwiic_Button_-_Red-01.jpg" align="right" width=300 alt="SparkFun Qwiic Button">
24+
25+
Python module for the [SparkFun Qwiic Button](https://www.sparkfun.com/products/15932)
26+
27+
This python package is a port of the existing [SparkFun Qwiic Button Arduino Library](https://github.com/sparkfun/SparkFun_Qwiic_Button_Arduino_Library)
28+
29+
This package can be used in conjunction with the overall [SparkFun qwiic Python Package](https://github.com/sparkfun/Qwiic_Py)
30+
31+
New to qwiic? Take a look at the entire [SparkFun qwiic ecosystem](https://www.sparkfun.com/qwiic).
32+
33+
## Contents
34+
35+
* [Supported Platforms](#supported-platforms)
36+
* [Dependencies](#dependencies)
37+
* [Installation](#installation)
38+
* [Documentation](#documentation)
39+
* [Example Use](#example-use)
40+
41+
Supported Platforms
42+
--------------------
43+
The qwiic Soil Moisture Sensor Python package current supports the following platforms:
44+
* [Raspberry Pi](https://www.sparkfun.com/search/results?term=raspberry+pi)
45+
* [NVidia Jetson Nano](https://www.sparkfun.com/products/15297)
46+
* [Google Coral Development Board](https://www.sparkfun.com/products/15318)
47+
48+
Dependencies
49+
--------------
50+
This driver package depends on the qwiic I2C driver:
51+
[Qwiic_I2C_Py](https://github.com/sparkfun/Qwiic_I2C_Py)
52+
53+
Documentation
54+
-------------
55+
The SparkFun Qwiic Button module documentation is hosted at [ReadTheDocs](https://qwiic-button-py.readthedocs.io/en/main/?)
56+
57+
Installation
58+
---------------
59+
### PyPi Installation
60+
61+
This repository is hosted on PyPi as the [sparkfun-qwiic-button](https://pypi.org/project/sparkfun-qwiic-button/) package. On systems that support PyPi installation via pip, this library is installed using the following commands
62+
63+
For all users (note: the user must have sudo privileges):
64+
```sh
65+
sudo pip install sparkfun-qwiic-button
66+
```
67+
For the current user:
68+
69+
```sh
70+
pip install sparkfun-qwiic-button
71+
```
72+
To install, make sure the setuptools package is installed on the system.
73+
74+
Direct installation at the command line:
75+
```sh
76+
python setup.py install
77+
```
78+
79+
To build a package for use with pip:
80+
```sh
81+
python setup.py sdist
82+
```
83+
A package file is built and placed in a subdirectory called dist. This package file can be installed using pip.
84+
```sh
85+
cd dist
86+
pip install sparkfun-qwiic-button-<version>.tar.gz
87+
```
88+
89+
Example Use
90+
-------------
91+
See the examples directory for more detailed use examples.
92+
93+
```python
94+
from __future__ import print_function
95+
import qwiic_button
96+
import time
97+
import sys
98+
99+
def run_example():
100+
101+
print("\nSparkFun Qwiic Button Example 1")
102+
my_button = qwiic_button.Qwiic_Button()
103+
104+
if my_button.begin() == False:
105+
print("\nThe Qwiic Button isn't connected to the system. Please check your connection", \
106+
file=sys.stderr)
107+
return
108+
print("\nButton ready!")
109+
110+
while True:
111+
112+
if my_button.is_button_pressed() == True:
113+
print("\nThe button is pressed!")
114+
115+
else:
116+
print("\nThe button is not pressed!")
117+
118+
time.sleep(0.02)
119+
120+
if __name__ == '__main__':
121+
try:
122+
run_example()
123+
except (KeyboardInterrupt, SystemExit) as exErr:
124+
print("\nEnding Example 1")
125+
sys.exit(0)
126+
127+
```
128+
<p align="center">
129+
<img src="https://cdn.sparkfun.com/assets/custom_pages/3/3/4/dark-logo-red-flame.png" alt="SparkFun - Start Something">
130+
</p>

0 commit comments

Comments
 (0)