Skip to content

Commit a5f161d

Browse files
authored
Merge pull request #10 from kattni/fix-up
Update with version info, README
2 parents 27baaaf + abe726a commit a5f161d

File tree

2 files changed

+44
-4
lines changed

2 files changed

+44
-4
lines changed

README.rst

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
21
Introduction
32
============
43

54
.. image:: https://readthedocs.org/projects/adafruit-circuitpython-fxas21002c/badge/?version=latest
65
:target: https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/
76
:alt: Documentation Status
87

9-
.. image :: https://img.shields.io/discord/327254708534116352.svg
8+
.. image:: https://img.shields.io/discord/327254708534116352.svg
109
:target: https://discord.gg/nBQh6qu
1110
:alt: Discord
1211

@@ -27,10 +26,48 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
2726
This is easily achieved by downloading
2827
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2928

29+
Installing from PyPI
30+
=====================
31+
On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from
32+
PyPI <https://pypi.org/project/adafruit-circuitpython-fxas21002c/>`_. To install for current user:
33+
34+
.. code-block:: shell
35+
36+
pip3 install adafruit-circuitpython-fxas21002c
37+
38+
To install system-wide (this may be required in some cases):
39+
40+
.. code-block:: shell
41+
42+
sudo pip3 install adafruit-circuitpython-fxas21002c
43+
44+
To install in a virtual environment in your current project:
45+
46+
.. code-block:: shell
47+
48+
mkdir project-name && cd project-name
49+
python3 -m venv .env
50+
source .env/bin/activate
51+
pip3 install adafruit-circuitpython-fxas21002c
52+
3053
Usage Example
3154
=============
3255

33-
See examples/simpletest.py for an example of the usage.
56+
.. code-block:: python
57+
58+
import time
59+
import board
60+
import busio
61+
import adafruit_fxas21002c
62+
63+
i2c = busio.I2C(board.SCL, board.SDA)
64+
sensor = adafruit_fxas21002c.FXAS21002C(i2c)
65+
66+
while True:
67+
gyro_x, gyro_y, gyro_z = sensor.gyroscope
68+
print('Gyroscope (radians/s): ({0:0.3f}, {1:0.3f}, {2:0.3f})'.format(gyro_x, gyro_y, gyro_z))
69+
time.sleep(1.0)
70+
3471
3572
Contributing
3673
============
@@ -84,4 +121,4 @@ Now, once you have the virtual environment activated:
84121
85122
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
86123
view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to
87-
locally verify it will pass.
124+
locally verify it will pass.

adafruit_fxas21002c.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,9 @@
5151
except ImportError:
5252
import struct
5353

54+
__version__ = "0.0.0-auto.0"
55+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FXAS21002C.git"
56+
5457
import adafruit_bus_device.i2c_device as i2c_dev
5558
from micropython import const
5659

0 commit comments

Comments
 (0)