Datasheet

You'll need to install the Adafruit_Blinka library that provides the CircuitPython support in Python. This may also
require enabling I2C on your platform and verifying you are running Python 3. Since each platform is a little different,
and Linux changes often, please visit the CircuitPython on Linux guide to get your computer
ready (https://adafru.it/BSN)!
Once that's done, from your command line run the following command:
sudo pip3 install adafruit-circuitpython-lsm6ds
If your default Python is version 3 you may need to run 'pip' instead. Just make sure you aren't trying to use
CircuitPython on Python 2.x, it isn't supported!
CircuitPython & Python Usage
To demonstrate the usage of the sensor we'll initialize it and read the acceleration and rotation measurements from
the board's Python REPL.
Run the following code to import the necessary modules and initialize the I2C connection with the sensor:
import time
import board
import busio
import adafruit_lsm6ds
i2c = busio.I2C(board.SCL, board.SDA)
sox = adafruit_lsm6ds.LSM6DSOX(i2c)
Now you're ready to read values from the sensor using these properties:
acceleration - The acceleration forces in the X, Y, and Z axes in m/s
gyro - The rotation measurement on the X, Y, and Z axes in degrees/sec
For example, to print out the acceleration and gyro measurements use this code:
print("Acceleration: X:%.2f, Y: %.2f, Z: %.2f m/s^2" % (sensor.acceleration))
print("Gyro X:%.2f, Y: %.2f, Z: %.2f degrees/s" % (sensor.gyro))
That's all there is to it! Go forth and imbue your robot friends with the gift of being able to maybe not fall down all the
time. Maybe.
Example Code
2
© Adafruit Industries https://learn.adafruit.com/lsm6dsox-and-ism330dhc-6-dof-imu Page 18 of 23