nanoFramework.Iot.Device.Lis2Mdl
1.0.545
Prefix Reserved
There is a newer prerelease version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Lis2Mdl --version 1.0.545
NuGet\Install-Package nanoFramework.Iot.Device.Lis2Mdl -Version 1.0.545
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.Lis2Mdl" Version="1.0.545" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="nanoFramework.Iot.Device.Lis2Mdl" Version="1.0.545" />
<PackageReference Include="nanoFramework.Iot.Device.Lis2Mdl" />
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.Lis2Mdl --version 1.0.545
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: nanoFramework.Iot.Device.Lis2Mdl, 1.0.545"
#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.Lis2Mdl@1.0.545
#: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.Lis2Mdl&version=1.0.545
#tool nuget:?package=nanoFramework.Iot.Device.Lis2Mdl&version=1.0.545
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
LIS2MDL - Ultra-low-power, high-performance 3-axis digital magnetic sensor
Some of the applications mentioned by the datasheet:
- Tilt-compensated compasses
- Map rotation
- Intelligent power saving for handheld devices
- Gaming and virtual reality input devices
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);
For other devices like STM32, please make sure you're using the preset pins for the I2C bus you want to use.
using Iot.Device.Lis2Mdl;
using System.Device.I2c;
using System.Diagnostics;
using System.Threading;
using Lis2Mdl lis2mdlDevice = new(CreateI2cDevice());
while (true)
{
var tempValue = lis2mdlDevice.Temperature;
var magFieldValue = lis2mdlDevice.MagneticField;
Debug.WriteLine($"Temperature: {tempValue.DegreesCelsius:F1}\u00B0C");
Debug.WriteLine($"Mag. field X: {magFieldValue[0].Milligausses:F3}mG");
Debug.WriteLine($"Mag. field Y: {magFieldValue[1].Milligausses:F3}mG");
Debug.WriteLine($"Mag. field Z: {magFieldValue[2].Milligausses:F3}mG");
Thread.Sleep(1000);
}
I2cDevice CreateI2cDevice()
{
I2cConnectionSettings settings = new(1, Lis2Mdl.DefaultI2cAddress);
return I2cDevice.Create(settings);
}
| Product | Versions 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.
-
- 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.Numerics (>= 1.2.862)
- nanoFramework.UnitsNet.MagneticField (>= 5.76.15)
- 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 |
|---|---|---|
| 2.0.0-preview.150 | 72 | 10/19/2026 |
| 2.0.0-preview.121 | 96 | 8/31/2026 |
| 2.0.0-preview.109 | 85 | 7/13/2026 |
| 2.0.0-preview.94 | 92 | 6/22/2026 |
| 2.0.0-preview.85 | 98 | 6/1/2026 |
| 2.0.0-preview.80 | 95 | 5/27/2026 |
| 2.0.0-preview.73 | 96 | 5/20/2026 |
| 2.0.0-preview.69 | 85 | 5/18/2026 |
| 2.0.0-preview.62 | 90 | 5/13/2026 |
| 2.0.0-preview.45 | 85 | 4/29/2026 |
| 2.0.0-preview.32 | 85 | 4/20/2026 |
| 2.0.0-preview.16 | 95 | 3/10/2026 |
| 1.0.545 | 145 | 8/31/2026 |
| 1.0.521 | 143 | 7/13/2026 |
| 1.0.496 | 155 | 6/22/2026 |
| 1.0.457 | 149 | 3/4/2026 |
| 1.0.436 | 306 | 11/10/2025 |
| 1.0.412 | 252 | 10/2/2025 |
| 1.0.394 | 230 | 7/28/2025 |
| 1.0.374 | 289 | 4/2/2025 |
Loading failed