Skip to main content

Class Lsm303agr

Represents a LSM303AGR is a system-in-package (SiP) that combines a 3D linear acceleration sensor and a 3D magnetic sensor

Assembly: Lsm303agr.dll
View Source
Declaration
public class Lsm303agr : PollingSensorBase<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)>, IObservable<IChangeResult<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)>>, ISamplingSensor<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)>, ISensor<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)>, IMagnetometer, ISamplingSensor<MagneticField3D>, ISensor<MagneticField3D>, IAccelerometer, ISamplingSensor<Acceleration3D>, ISensor<Acceleration3D>, ISensor, ISamplingSensor, II2cPeripheral

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

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>, Meadow.Peripherals.Sensors.Motion.IMagnetometer, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.MagneticField3D>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.MagneticField3D>, Meadow.Peripherals.Sensors.Motion.IAccelerometer, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Acceleration3D>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Acceleration3D>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral

Properties

Acceleration3D

Current Acceleration 3D

View Source
Declaration
public Acceleration3D? Acceleration3D { get; }

MagneticField3D

Current Magnetic Field 3D

View Source
Declaration
public MagneticField3D? MagneticField3D { get; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

Methods

SetAccelerometerSensitivity(AccSensitivity)

Sets the sensitivity of the accelerometer

View Source
Declaration
public void SetAccelerometerSensitivity(Lsm303agr.AccSensitivity sensitivity)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Motion.Lsm303agr.AccSensitivitysensitivityThe desired sensitivity setting, specified by the AccSensitivity enum.

GetAccelerometerSensitivity()

Retrieves the current sensitivity setting of the accelerometer

View Source
Declaration
public Lsm303agr.AccSensitivity GetAccelerometerSensitivity()
Returns

Meadow.Foundation.Sensors.Motion.Lsm303agr.AccSensitivity: The current sensitivity setting, represented by the AccSensitivity enum.### RaiseEventsAndNotify(IChangeResult<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)>) Raise events for subscribers and notify of value changes

View Source
Declaration
protected override void RaiseEventsAndNotify(IChangeResult<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)> changeResult)
Parameters
TypeNameDescription
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>changeResultThe updated sensor data

ReadSensor()

Reads data from the sensor

View Source
Declaration
protected override Task<(Acceleration3D? Acceleration3D, MagneticField3D? MagneticField3D)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>: The latest sensor reading### SetAccelerometerOutputDataRate(AccOutputDataRate) Sets the output data rate for the accelerometer.

View Source
Declaration
public void SetAccelerometerOutputDataRate(Lsm303agr.AccOutputDataRate dataRate)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Motion.Lsm303agr.AccOutputDataRatedataRateThe desired output data rate setting.

GetAccelerometerOutputDataRate()

Retrieves the current output data rate setting for the accelerometer.

View Source
Declaration
public Lsm303agr.AccOutputDataRate GetAccelerometerOutputDataRate()
Returns

Meadow.Foundation.Sensors.Motion.Lsm303agr.AccOutputDataRate: The current output data rate setting.### SetMagnetometerOutputDataRate(MagOutputDataRate) Sets the output data rate for the magnetometer.

View Source
Declaration
public void SetMagnetometerOutputDataRate(Lsm303agr.MagOutputDataRate dataRate)
Parameters
TypeNameDescription
Meadow.Foundation.Sensors.Motion.Lsm303agr.MagOutputDataRatedataRateThe desired output data rate setting.

GetMagnetometerOutputDataRate()

Retrieves the current output data rate setting for the magnetometer.

View Source
Declaration
public Lsm303agr.MagOutputDataRate GetMagnetometerOutputDataRate()
Returns

Meadow.Foundation.Sensors.Motion.Lsm303agr.MagOutputDataRate: The current output data rate setting.

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Acceleration3D>,System.Nullable<Meadow.Units.MagneticField3D>>>
  • Meadow.Peripherals.Sensors.Motion.IMagnetometer
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.MagneticField3D>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.MagneticField3D>
  • Meadow.Peripherals.Sensors.Motion.IAccelerometer
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Acceleration3D>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Acceleration3D>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral