Datasheet
Finally follow the same process for the Adafruit Unified Sensor library:
Load Example
Open up File -> Examples -> Adafruit LSM6DS -> adafruit_lsm6dsox_test and upload to your Arduino wired up to the
sensor.
Depending on whether you are using I2C or SPI, change the pin names and comment or uncomment the following
lines.
if (!lsm6dsox.begin_I2C()) {
//if (!lsm6dsox.begin_SPI(LPS_CS)) {
//if (!lsm6dsox.begin_SPI(LPS_CS, LPS_SCK, LPS_MISO, LPS_MOSI)) {
Once you upload the code, you will see the accelerometer, gyro, and temperature measurements being printed when
you open the Serial Monitor (Tools->Serial Monitor) at 115200 baud, similar to this:
Give the sensor a wiggle or a spin and watch how the measurements change!
Example Code
// Basic demo for accelerometer & gyro readings from Adafruit
// LSM6DSOX sensor
#include <Adafruit_LSM6DSOX.h>
// For SPI mode, we need a CS pin
#define LSM_CS 10
// For software-SPI mode we need SCK/MOSI/MISO pins
#define LSM_SCK 13
#define LSM_MISO 12
© Adafruit Industries https://learn.adafruit.com/lsm6dsox-and-ism330dhc-6-dof-imu Page 10 of 23










