MicroPython LSM6DSOX Library¶
lsm6dsox
¶
MicroPython Library for the ST LSM6DSOX accelerometer/gyro Sensor
Author(s): Bryan Siepert, Jose D. Montoya
lsm6dsox
¶
MicroPython Library for the ST LSM6DSOX accelerometer/gyro Sensor
Author(s): Bryan Siepert, Jose D. Montoya
-
class micropython_lsm6dsox.lsm6dsox.LSM6DSOX(i2c, address: int =
0x6A
)[source]¶ Driver for the LSM6DSOX Sensor connected over I2C.
- Parameters:¶
- Raises:¶
RuntimeError – if the sensor is not found
Quickstart: Importing and using the device
Here is an example of using the
LSM6DSOX
class. First you will need to import the libraries to use the sensorfrom machine import Pin, I2C from micropython_lsm6dsox import lsm6dsox
Once this is done you can define your
machine.I2C
object and define your sensor objecti2c = I2C(1, sda=Pin(2), scl=Pin(3)) lsm6dsox = lsm6dsox.LSM6DSOX(i2c)
Now you have access to the attributes
accx, accy, accz = lsm6dsox.acceleration
- property acceleration : tuple[float, float, float]¶
The x, y, z acceleration values returned in a 3-tuple and are in m / s ^ 2.
- property acceleration_data_rate : str¶
Sensor acceleration_data_rate
Mode
Value
lsm6dsox.RATE_SHUTDOWN
0b0000
lsm6dsox.RATE_12_5_HZ
0b0001
lsm6dsox.RATE_26_HZ
0b0010
lsm6dsox.RATE_52_HZ
0b0011
lsm6dsox.RATE_104_HZ
0b0100
lsm6dsox.RATE_208_HZ
0b0101
lsm6dsox.RATE_416_HZ
0b0110
lsm6dsox.RATE_833_HZ
0b0111
lsm6dsox.RATE_1_66K_HZ
0b1000
lsm6dsox.RATE_3_33K_HZ
0b1001
lsm6dsox.RATE_6_66K_HZ
0b1010
lsm6dsox.RATE_1_6_HZ
0b1011
- property acceleration_range : int¶
Sensor acceleration_range
Mode
Value
lsm6dsox.RANGE_2G
0b00
lsm6dsox.RANGE_4G
0b10
lsm6dsox.RANGE_8G
0b11
lsm6dsox.RANGE_16G
0b01
- property gyro : tuple[float, float, float]¶
The x, y, z angular velocity values returned in a 3-tuple and are in radians / second
- property gyro_data_rate : str¶
Sensor gyro_data_rate
Mode
Value
lsm6dsox.RATE_SHUTDOWN
0b0000
lsm6dsox.RATE_12_5_HZ
0b0001
lsm6dsox.RATE_26_HZ
0b0010
lsm6dsox.RATE_52_HZ
0b0011
lsm6dsox.RATE_104_HZ
0b0100
lsm6dsox.RATE_208_HZ
0b0101
lsm6dsox.RATE_416_HZ
0b0110
lsm6dsox.RATE_833_HZ
0b0111
lsm6dsox.RATE_1_66K_HZ
0b1000
lsm6dsox.RATE_3_33K_HZ
0b1001
lsm6dsox.RATE_6_66K_HZ
0b1010
lsm6dsox.RATE_1_6_HZ
0b1011
- property gyro_range : int¶
Sensor gyro_range
Mode
Value
lsm6dsox.RANGE_250_DPS
0b00
lsm6dsox.RANGE_500_DPS
0b01
lsm6dsox.RANGE_1000_DPS
0b10
lsm6dsox.RANGE_2000_DPS
0b11