Skip to content

Commit ea8fc57

Browse files
authored
Merge pull request #13 from kattni/fix-up
Update version info, README
2 parents ff0b8dc + 397bae5 commit ea8fc57

File tree

2 files changed

+44
-2
lines changed

2 files changed

+44
-2
lines changed

README.rst

Lines changed: 41 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,49 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
2727
This is easily achieved by downloading
2828
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle>`_.
2929

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

33-
See examples/simpletest.py for a demo of the usage.
57+
.. code-block:: python
58+
59+
import time
60+
import board
61+
import busio
62+
import adafruit_fxos8700
63+
64+
i2c = busio.I2C(board.SCL, board.SDA)
65+
sensor = adafruit_fxos8700.FXOS8700(i2c)
66+
67+
while True:
68+
accel_x, accel_y, accel_z = sensor.accelerometer
69+
mag_x, mag_y, mag_z = sensor.magnetometer
70+
print('Acceleration (m/s^2): ({0:0.3f}, {1:0.3f}, {2:0.3f})'.format(accel_x, accel_y, accel_z))
71+
print('Magnetometer (uTesla): ({0:0.3f}, {1:0.3f}, {2:0.3f})'.format(mag_x, mag_y, mag_z))
72+
time.sleep(1.0)
3473
3574
Contributing
3675
============
@@ -84,4 +123,4 @@ Now, once you have the virtual environment activated:
84123
85124
This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to
86125
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
126+
locally verify it will pass

adafruit_fxos8700.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@
5353
import adafruit_bus_device.i2c_device as i2c_dev
5454
from micropython import const
5555

56+
__version__ = "0.0.0-auto.0"
57+
__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_FXOS8700.git"
58+
5659
# Register addresses and other constants:
5760
# pylint: disable=bad-whitespace
5861
_FXOS8700_ADDRESS = const(0x1F) # 0011111

0 commit comments

Comments
 (0)