Skip to main content

Class Hmc5883

Driver for the Hmc5883 digital compass

This driver is untested

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

Inheritance: System.Object -> Meadow.Foundation.ObservableBase<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
Declaration
public byte DefaultI2cAddress { get; }

Direction

HMC5883L Direction as a Vector

View Source
Declaration
public Vector? Direction { get; }

Heading

HMC5883L Heading (DEG)

View Source
Declaration
public Azimuth? Heading { get; }

DeviceStatus

HMC5883L Status

View Source
Declaration
public Hmc5883.Statuses DeviceStatus { get; }

Methods

Initialize()

Initialize the sensor

View Source
Declaration
protected virtual void Initialize()

ReadSensor()

Reads data from the sensor

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

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

View Source
Declaration
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