nanoFramework.Iot.Device.Lis3Dh 1.0.1

Prefix Reserved
dotnet add package nanoFramework.Iot.Device.Lis3Dh --version 1.0.1
                    
NuGet\Install-Package nanoFramework.Iot.Device.Lis3Dh -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.Lis3Dh" 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.Lis3Dh" Version="1.0.1" />
                    
Directory.Packages.props
<PackageReference Include="nanoFramework.Iot.Device.Lis3Dh" />
                    
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.Lis3Dh --version 1.0.1
                    
#r "nuget: nanoFramework.Iot.Device.Lis3Dh, 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.Lis3Dh@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.Lis3Dh&version=1.0.1
                    
Install as a Cake Addin
#tool nuget:?package=nanoFramework.Iot.Device.Lis3Dh&version=1.0.1
                    
Install as a Cake Tool

LIS3DH - ultra-low-power high-performance 3-axis accelerometer

The LIS3DH is an ultra-low-power, high-performance three-axis linear accelerometer from STMicroelectronics. It supports selectable plus or minus 2 g, 4 g, 8 g, and 16 g full-scale ranges. The sensor supports I2C and SPI; this binding currently supports I2C.

Documentation

Wiring

Connect VIN and GND according to the breakout board requirements, then connect SDA and SCL to the selected I2C bus. Tie SDO/SA0 low to use DefaultI2cAddress (0x18) or high to use SecondaryI2cAddress (0x19).

On ESP32, configure the I2C pins before creating the device:

Configuration.SetPinFunction(Gpio.IO21, DeviceFunction.I2C1_DATA);
Configuration.SetPinFunction(Gpio.IO22, DeviceFunction.I2C1_CLOCK);

For STM32 and other targets, use the hardware I2C pins configured by the firmware.

Usage

using Iot.Device.Lis3DhAccelerometer;
using System.Device.I2c;
using System.Diagnostics;
using System.Numerics;
using System.Threading;

I2cConnectionSettings settings = new(1, Lis3Dh.DefaultI2cAddress);
using I2cDevice i2cDevice = I2cDevice.Create(settings);
using Lis3Dh accelerometer = Lis3Dh.Create(
    i2cDevice,
    DataRate.DataRate10Hz,
    OperatingMode.HighResolutionMode,
    AccelerationScale.Scale04G);

while (true)
{
    Vector3 acceleration = accelerometer.Acceleration;
    Debug.WriteLine($"X: {acceleration.X:F4} g, Y: {acceleration.Y:F4} g, Z: {acceleration.Z:F4} g");
    Thread.Sleep(100);
}

Acceleration returns a Vector3 whose components are measured in gravitational force (g).

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 99 9/29/2026