Skip to main content

Class Hmc5883

Driver for the Hmc5883 digital compass

This driver is untested

Assembly: Hmc5883.dll
View Source
public class Hmc5883 : ByteCommsSensorBase<Vector>, IObservable<IChangeResult<Vector>>, ISamplingSensor<Vector>, ISensor<Vector>, ISensor, ISamplingSensor, IDisposable, II2cPeripheral

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<UNIT> -> Meadow.Foundation.SamplingSensorBase<UNIT> -> Meadow.Foundation.PollingSensorBase<UNIT> -> Meadow.Foundation.ByteCommsSensorBase<UNIT>

Derived:
Meadow.Foundation.Sensors.Motion.Qmc5883

Implements:
System.IObservable<Meadow.IChangeResult<Meadow.Foundation.Spatial.Vector>>, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Foundation.Spatial.Vector>, Meadow.Peripherals.Sensors.ISensor<Meadow.Foundation.Spatial.Vector>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, System.IDisposable, Meadow.Hardware.II2cPeripheral

Properties

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

Direction

HMC5883L Direction as a Vector

View Source
public Vector? Direction { get; }

Heading

HMC5883L Heading (DEG)

View Source
public Azimuth? Heading { get; }

DeviceStatus

HMC5883L Status

View Source
public Hmc5883.Statuses DeviceStatus { get; }

Methods

Initialize()

Initialize the sensor

View Source
protected virtual void Initialize()

ReadSensor()

Reads data from the sensor

View Source
protected override Task<Vector> ReadSensor()
Returns

System.Threading.Tasks.Task<Meadow.Foundation.Spatial.Vector>: The latest sensor reading### DirectionToHeading(Vector) Calculate heading

View Source
public static Azimuth DirectionToHeading(Vector direction)
Returns

Meadow.Units.Azimuth: Heading (DEG)

Parameters
TypeNameDescription
Meadow.Foundation.Spatial.VectordirectionHMC5883L Direction

Implements

  • System.IObservable<Meadow.IChangeResult<Meadow.Foundation.Spatial.Vector>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Foundation.Spatial.Vector>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Foundation.Spatial.Vector>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • System.IDisposable
  • Meadow.Hardware.II2cPeripheral