adafruit_lsm303_accel
CircuitPython driver for the accelerometer in LSM303 sensors.
Author(s): Dave Astels, Bryan Siepert
Hardware:
Adafruit Triple-axis Accelerometer+Magnetometer (Compass) Board - LSM303 (Product ID: 1120)
Adafruit FLORA Accelerometer/Compass Sensor - LSM303 - v1.0 (Product ID: 1247)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://circuitpython.org/downloads
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Driver for the LSM303’s accelerometer.
i2c (I2C) – The I2C bus the device is connected to.
Quickstart: Importing and using the device
Here is an example of using the
LSM303_Accel
class. First you will need to import the libraries to use the sensorimport board import adafruit_lsm303_accelOnce this is done you can define your
board.I2C
object and define your sensor objecti2c = board.I2C() # uses board.SCL and board.SDA sensor = adafruit_lsm303_accel.LSM303_Accel(i2c)Now you have access to the
acceleration
attributeacc_x, acc_y, acc_z = sensor.acceleration
The measured accelerometer sensor values. A 3-tuple of X, Y, Z axis values in m/s^2 squared that are signed floats.
Select the rate at which the sensor takes measurements. Must be a Rate
Sets the power mode of the sensor. The mode must be a Mode
. Note that the mode and range will both affect the accuracy of the sensor
Adjusts the range of values that the sensor can measure, from +- 2G to +-16G Note that larger ranges will be less accurate. Must be a Range
The tap detection parameters.
tap (int) – 0 to disable tap detection, 1 to detect only single taps, and 2 to detect only double taps.
threshold (int) – A threshold for the tap detection. The higher the value the less sensitive the detection. This changes based on the accelerometer range. Good values are 5-10 for 16G, 10-20 for 8G, 20-40 for 4G, and 40-80 for 2G.
time_limit (int) – TIME_LIMIT register value. Defaults to 10
time_latency (int) – TIME_LATENCY register value. Defaults to 20
time_window (int) – TIME_WINDOW register value. Defaults to 255
Options for mode
Options for range
Options for data_rate
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4