nanoFramework.Iot.Device.Hmc5883l
1.2.141
Prefix Reserved
See the version list below for details.
dotnet add package nanoFramework.Iot.Device.Hmc5883l --version 1.2.141
NuGet\Install-Package nanoFramework.Iot.Device.Hmc5883l -Version 1.2.141
<PackageReference Include="nanoFramework.Iot.Device.Hmc5883l" Version="1.2.141" />
<PackageVersion Include="nanoFramework.Iot.Device.Hmc5883l" Version="1.2.141" />
<PackageReference Include="nanoFramework.Iot.Device.Hmc5883l" />
paket add nanoFramework.Iot.Device.Hmc5883l --version 1.2.141
#r "nuget: nanoFramework.Iot.Device.Hmc5883l, 1.2.141"
#addin nuget:?package=nanoFramework.Iot.Device.Hmc5883l&version=1.2.141
#tool nuget:?package=nanoFramework.Iot.Device.Hmc5883l&version=1.2.141
HMC5883L - 3 Axis Digital Compass
HMC5883L is a surface-mount, multi-chip module designed for low-field magnetic sensing with a digital interface for applications such as lowcost compassing and magnetometry.
Documentation
- HMC5883L datasheet
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.
I2cConnectionSettings settings = new I2cConnectionSettings(1, Hmc5883l.DefaultI2cAddress);
I2cDevice device = I2cDevice.Create(settings);
using (Hmc5883l sensor = new Hmc5883l(device))
{
// read direction vector
Vector3 directionVector = sensor.DirectionVector;
// read heading
double heading = sensor.Heading;
// read status
Status status = sensor.DeviceStatus;
}
From the HMC5883L sample, you can go further with the following:
I2cConnectionSettings settings = new I2cConnectionSettings(1, Hmc5883l.DefaultI2cAddress);
I2cDevice device = I2cDevice.Create(settings);
using (Hmc5883l sensor = new Hmc5883l(device))
{
while (true)
{
// read heading
Debug.WriteLine($"Heading: {sensor.Heading.ToString("0.00")} °");
Debug.WriteLine();
// wait for a second
Thread.Sleep(1000);
}
}
Hardware Required
- HMC5883L
- Male/Female Jumper Wires
Circuit
- SCL - SCL
- SDA - SDA
- VCC - 5V
- GND - GND
Result
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET Framework | net is compatible. |
-
- nanoFramework.CoreLibrary (>= 1.12.0)
- nanoFramework.System.Buffers.Binary.BinaryPrimitives (>= 1.2.82)
- nanoFramework.System.Device.I2c (>= 1.0.3)
- nanoFramework.System.Device.Model (>= 1.2.82)
- nanoFramework.System.Math (>= 1.5.12)
- nanoFramework.System.Numerics (>= 1.2.132)
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.2.852 | 151 | 22 days ago |
1.2.822 | 96 | a month ago |
1.2.775 | 104 | 2 months ago |
1.2.772 | 85 | 2 months ago |
1.2.755 | 95 | 2 months ago |
1.2.737 | 78 | 3 months ago |
1.2.704 | 102 | 3 months ago |
1.2.696 | 99 | 4 months ago |
1.2.673 | 103 | 5 months ago |
1.2.631 | 101 | 7 months ago |
1.2.590 | 108 | 9 months ago |
1.2.570 | 110 | 10 months ago |
1.2.436 | 276 | 11/10/2023 |
1.2.416 | 115 | 11/8/2023 |
1.2.329 | 210 | 5/26/2023 |
1.2.313 | 170 | 5/12/2023 |
1.2.297 | 174 | 5/3/2023 |
1.2.253 | 283 | 2/22/2023 |
1.2.222 | 318 | 1/9/2023 |
1.2.217 | 363 | 1/6/2023 |
1.2.212 | 319 | 1/5/2023 |
1.2.208 | 355 | 1/3/2023 |
1.2.203 | 343 | 12/28/2022 |
1.2.159 | 393 | 11/14/2022 |
1.2.153 | 380 | 11/5/2022 |
1.2.141 | 421 | 10/25/2022 |
1.2.128 | 413 | 10/22/2022 |
1.2.87 | 527 | 9/15/2022 |
1.2.82 | 528 | 9/14/2022 |
1.1.116.8772 | 494 | 6/24/2022 |
1.1.113.2032 | 464 | 6/23/2022 |
1.1.97.17326 | 492 | 6/13/2022 |
1.1.92.53000 | 454 | 6/8/2022 |
1.1.58.10097 | 469 | 5/23/2022 |
1.1.3 | 529 | 4/15/2022 |
1.1.1 | 478 | 4/14/2022 |
1.0.300 | 484 | 3/31/2022 |
1.0.288-preview.114 | 147 | 3/25/2022 |
1.0.288-preview.113 | 136 | 3/25/2022 |
1.0.288-preview.106 | 136 | 3/23/2022 |
1.0.288-preview.104 | 128 | 3/22/2022 |
1.0.288-preview.100 | 142 | 3/19/2022 |
1.0.288-preview.98 | 137 | 3/18/2022 |
1.0.288-preview.95 | 140 | 3/15/2022 |
1.0.288-preview.93 | 139 | 3/15/2022 |
1.0.288-preview.87 | 139 | 3/10/2022 |
1.0.288-preview.65 | 136 | 2/18/2022 |
1.0.288-preview.48 | 152 | 2/4/2022 |
1.0.288-preview.41 | 154 | 1/31/2022 |
1.0.288-preview.29 | 151 | 1/28/2022 |
1.0.288-preview.20 | 153 | 1/27/2022 |
1.0.288-preview.1 | 155 | 1/21/2022 |
1.0.259 | 357 | 12/9/2021 |
1.0.155 | 344 | 8/31/2021 |
1.0.130 | 188 | 7/6/2021 |
1.0.129 | 185 | 7/6/2021 |
1.0.125 | 217 | 7/5/2021 |
1.0.121 | 224 | 6/29/2021 |
1.0.119 | 258 | 6/28/2021 |
1.0.32 | 195 | 5/24/2021 |