This library allows you to read accelerometer, gyroscope, and temperature values from the LSM6DSOX IMU.
This library supports the API exposed by the LSM6DSOX sensor over I2C and SPI.
- 📏 Accelerometer Control
- Read X, Y, and Z acceleration (in g)
- Check available samples
- Get sampling rate
- 🔄 Gyroscope Control
- Read X, Y, and Z gyroscope values (in degrees/second)
- Check available samples
- Get sampling rate
- 🌡 Temperature Sensor Control
- Read temperature (in °C, integer or float formats)
- Check availability of temperature samples
For more information on the features of this library and how to use them, please read the API documentation here.
The library should work on any board that uses a modern Arduino core. It requires either an I2C or SPI interface to connect to an LSM6DSOX sensor.
The default IMU variable uses the standard Wire interface. If the IMU is connected to a different interface, an instance of LSM6DSOXClass can be declared using custom I2C or SPI pins. e.g.
// Custom I2C device
LSM6DSOXClass myIMU = LSM6DSOXClass(Wire1, 0x6A);
// Custom SPI device
LSM6DSOXClass myIMU_SPI = LSM6DSOXClass(SPI, 10, 2);The library is preinstalled in Arduino Cloud Editor.
Arduino IDE users can install it via Library Manager.
Arduino CLI can install it with arduino-cli lib install Arduino_LSM6DSOX. You may need to update the index beforehand using arduino-cli lib update-index.
Clone the repository and then run any example using the Arduino CLI. e.g.
arduino-cli compile examples/SimpleAccelerometer/SimpleAccelerometer.ino -b arduino:mbed_nano:nanorp2040connect --library ./ -u -p /dev/cu.usbmodem14201If you encounter any issue, please open a bug report here.
- Datasheet:
Pull requests are welcome. For major changes, please open an issue first to discuss what you would like to change.
If you have questions about using the library, you can get assistance on Arduino Forum:
This library is released under the GNU Lesser General Public License v2.1 (LGPL).