LSM6DSO Example#
This example demonstrates how to use the espp LSM6DSO 6-axis IMU driver with the ESP-IDF. The example is modeled after the ICM42607 example and shows how to configure the IMU, read accelerometer and gyroscope data, and use orientation filtering (e.g., Madgwick filter).
Features#
I2C communication with the LSM6DSO
Configurable accelerometer and gyroscope range and output data rate
Periodic reading of accelerometer, gyroscope, and temperature data
Orientation filtering using Madgwick filter
Usage#
Configure the I2C pins and address in
sdkconfigor via Kconfig optionsBuild and flash the example to your ESP32/ESP-IDF target
The example will print IMU data and orientation to the serial console
Build and Flash#
Build the project and flash it to the board, then run monitor tool to view serial output:
idf.py -p PORT flash monitor
(Replace PORT with the name of the serial port to use.)
(To exit the serial monitor, type Ctrl-].)
See the Getting Started Guide for full steps to configure and use ESP-IDF to build projects.
Example Output#
Example Code#
See main/lsm6dso_example.cpp for the full example source code.
Configuration#
Default I2C address: 0x6A (can be changed in Kconfig or via config struct)
Example I2C pins: SDA = 21, SCL = 22
Documentation#
See the documentation for full API details.