@@ -27,10 +27,49 @@ Please ensure all dependencies are available on the CircuitPython filesystem.
27
27
This is easily achieved by downloading
28
28
`the Adafruit library and driver bundle <https://github.com/adafruit/Adafruit_CircuitPython_Bundle >`_.
29
29
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
+
30
54
Usage Example
31
55
=============
32
56
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 )
34
73
35
74
Contributing
36
75
============
@@ -84,4 +123,4 @@ Now, once you have the virtual environment activated:
84
123
85
124
This will output the documentation to ``docs/_build/html ``. Open the index.html in your browser to
86
125
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
0 commit comments