1
-
2
1
Introduction
3
2
============
4
3
5
4
.. image :: https://readthedocs.org/projects/adafruit-circuitpython-fxas21002c/badge/?version=latest
6
5
:target: https://circuitpython.readthedocs.io/projects/fxas21002c/en/latest/
7
6
:alt: Documentation Status
8
7
9
- .. image :: https://img.shields.io/discord/327254708534116352.svg
8
+ .. image :: https://img.shields.io/discord/327254708534116352.svg
10
9
:target: https://discord.gg/nBQh6qu
11
10
:alt: Discord
12
11
@@ -27,10 +26,48 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
27
26
This is easily achieved by downloading
28
27
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
29
28
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
+
30
53
Usage Example
31
54
=============
32
55
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
+
34
71
35
72
Contributing
36
73
============
@@ -84,4 +121,4 @@ Now, once you have the virtual environment activated:
84
121
85
122
This will output the documentation to ``docs/_build/html ``. Open the index.html in your browser to
86
123
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.
0 commit comments