From 4b8fa7760a08eac8c6b993a3bca4ac76ce97a158 Mon Sep 17 00:00:00 2001 From: Kattni Rembor Date: Mon, 23 Sep 2019 18:15:26 -0400 Subject: [PATCH] Update version info, README --- README.rst | 46 +++++++++++++++++++++++++++++++++++++++++++-- adafruit_lsm9ds0.py | 3 +++ 2 files changed, 47 insertions(+), 2 deletions(-) diff --git a/README.rst b/README.rst index e62f345..f241833 100644 --- a/README.rst +++ b/README.rst @@ -27,10 +27,52 @@ Please ensure all dependencies are available on the CircuitPython filesystem. This is easily achieved by downloading `the Adafruit library and driver bundle `_. +Installing from PyPI +===================== +On supported GNU/Linux systems like the Raspberry Pi, you can install the driver locally `from +PyPI `_. To install for current user: + +.. code-block:: shell + + pip3 install adafruit-circuitpython-lsm9ds0 + +To install system-wide (this may be required in some cases): + +.. code-block:: shell + + sudo pip3 install adafruit-circuitpython-lsm9ds0 + +To install in a virtual environment in your current project: + +.. code-block:: shell + + mkdir project-name && cd project-name + python3 -m venv .env + source .env/bin/activate + pip3 install adafruit-circuitpython-lsm9ds0 + Usage Example ============= -See examples/lsm9ds0_simpletest.py for a demo of the usage. +.. code-block:: python + + import time + import board + import busioimport adafruit_lsm9ds0 + + i2c = busio.I2C(board.SCL, board.SDA) + sensor = adafruit_lsm9ds0.LSM9DS0_I2C(i2c) + + while True: + accel_x, accel_y, accel_z = sensor.acceleration + mag_x, mag_y, mag_z = sensor.magnetic + gyro_x, gyro_y, gyro_z = sensor.gyro + temp = sensor.temperature + print('Acceleration (m/s^2): ({0:0.3f},{1:0.3f},{2:0.3f})'.format(accel_x, accel_y, accel_z)) + print('Magnetometer (gauss): ({0:0.3f},{1:0.3f},{2:0.3f})'.format(mag_x, mag_y, mag_z)) + print('Gyroscope (degrees/sec): ({0:0.3f},{1:0.3f},{2:0.3f})'.format(gyro_x, gyro_y, gyro_z)) + print('Temperature: {0:0.3f}C'.format(temp)) + time.sleep(1.0) Contributing ============ @@ -84,4 +126,4 @@ Now, once you have the virtual environment activated: This will output the documentation to ``docs/_build/html``. Open the index.html in your browser to view them. It will also (due to -W) error out on any warning like Travis will. This is a good way to -locally verify it will pass. \ No newline at end of file +locally verify it will pass. diff --git a/adafruit_lsm9ds0.py b/adafruit_lsm9ds0.py index 14801d7..ad27229 100644 --- a/adafruit_lsm9ds0.py +++ b/adafruit_lsm9ds0.py @@ -59,6 +59,9 @@ from micropython import const +__version__ = "0.0.0-auto.0" +__repo__ = "https://github.com/adafruit/Adafruit_CircuitPython_LSM9DS0.git" + # Internal constants and register values: # pylint: disable=bad-whitespace _LSM9DS0_ADDRESS_ACCELMAG = const(0x1D) # 3B >> 1 = 7bit default