nanoFramework.Iot.Device.Lsm6Dsl
1.0.1
Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Lsm6Dsl --version 1.0.1
NuGet\Install-Package nanoFramework.Iot.Device.Lsm6Dsl -Version 1.0.1
<PackageReference Include="nanoFramework.Iot.Device.Lsm6Dsl" Version="1.0.1" />
<PackageVersion Include="nanoFramework.Iot.Device.Lsm6Dsl" Version="1.0.1" />
<PackageReference Include="nanoFramework.Iot.Device.Lsm6Dsl" />
paket add nanoFramework.Iot.Device.Lsm6Dsl --version 1.0.1
#r "nuget: nanoFramework.Iot.Device.Lsm6Dsl, 1.0.1"
#:package nanoFramework.Iot.Device.Lsm6Dsl@1.0.1
#addin nuget:?package=nanoFramework.Iot.Device.Lsm6Dsl&version=1.0.1
#tool nuget:?package=nanoFramework.Iot.Device.Lsm6Dsl&version=1.0.1
LSM6DSL - three-axis accelerometer and gyroscope
The LSM6DSL is a low-power six-axis inertial measurement unit combining a three-axis accelerometer and a three-axis gyroscope. It is included on boards such as the ST B-L475E-IOT01A Discovery kit.
Documentation
Usage
Important: make sure you properly setup the I2C pins especially for ESP32 before creating the I2cDevice, make sure you install the nanoFramework.Hardware.ESP32 nuget:
//////////////////////////////////////////////////////////////////////
// when connecting to an ESP32 device, need to configure the I2C GPIOs
// used for the bus
Configuration.SetPinFunction(21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(22, DeviceFunction.I2C1_CLOCK);
The on-board LSM6DSL on the B-L475E-IOT01A uses address 0x6A and the board's sensor I2C bus. The sample uses bus 2; adjust the bus number if your firmware maps that peripheral differently.
using Iot.Device.Lsm6Dsl;
using System.Device.I2c;
using System.Diagnostics;
using System.Threading;
I2cConnectionSettings settings = new(2, Lsm6Dsl.DefaultI2cAddress);
using Lsm6Dsl sensor = new(I2cDevice.Create(settings));
sensor.AccelerationScale = AccelerationScale.Scale02G;
sensor.AngularRateScale = AngularRateScale.Scale0250Dps;
while (true)
{
var acceleration = sensor.Acceleration;
var angularRate = sensor.AngularRate;
Debug.WriteLine($"Acceleration: X={acceleration.X:F3} g, Y={acceleration.Y:F3} g, Z={acceleration.Z:F3} g");
Debug.WriteLine($"Angular rate: X={angularRate.X:F2} dps, Y={angularRate.Y:F2} dps, Z={angularRate.Z:F2} dps");
Debug.WriteLine($"Temperature: {sensor.Temperature.DegreesCelsius:F1} C");
Thread.Sleep(1000);
}
The driver supports accelerometer ranges from plus or minus 2 g to plus or minus 16 g, gyroscope ranges from plus or minus 125 dps to plus or minus 2000 dps, independent output data rates, data-ready status, and internal temperature.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.17.11)
- nanoFramework.System.Buffers.Binary.BinaryPrimitives (>= 1.2.862)
- nanoFramework.System.Device.I2c (>= 1.1.29)
- nanoFramework.System.Device.Model (>= 1.2.862)
- nanoFramework.System.Math (>= 1.5.116)
- nanoFramework.System.Numerics (>= 1.2.862)
- nanoFramework.UnitsNet.Temperature (>= 5.76.15)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.1 | 105 | 9/26/2026 |