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
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="nanoFramework.Iot.Device.Lsm6Dsl" Version="1.0.1" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Lsm6Dsl" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Lsm6Dsl" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add nanoFramework.Iot.Device.Lsm6Dsl --version 1.0.1
                    
#r "nuget: nanoFramework.Iot.Device.Lsm6Dsl, 1.0.1"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package nanoFramework.Iot.Device.Lsm6Dsl@1.0.1
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=nanoFramework.Iot.Device.Lsm6Dsl&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Lsm6Dsl&version=1.0.1
                    
Install as a Cake Tool

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 Compatible and additional computed target framework versions.
.NET Framework net is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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