Skip to main content

Class Mpl3115a2

Driver for the MPL3115A2 pressure and humidity sensor

Assembly: Mpl3115a2.dll
View Source
public class Mpl3115a2 : ByteCommsSensorBase<(Temperature? Temperature, Pressure? Pressure)>, IObservable<IChangeResult<(Temperature? Temperature, Pressure? Pressure)>>, ISamplingSensor<(Temperature? Temperature, Pressure? Pressure)>, ISensor<(Temperature? Temperature, Pressure? Pressure)>, IDisposable, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, IBarometricPressureSensor, ISamplingSensor<Pressure>, ISensor<Pressure>, ISensor, ISamplingSensor, II2cPeripheral

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

Implements:

Expand

System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>>, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>, System.IDisposable, Meadow.Peripherals.Sensors.ITemperatureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.Atmospheric.IBarometricPressureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Pressure>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Pressure>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral

Properties

Temperature

The temperature, from the last reading.

View Source
public Temperature? Temperature { get; }

Pressure

The pressure, from the last reading.

View Source
public Pressure? Pressure { get; }

Standby

Check if the part is in standby mode or change the standby mode.

View Source
public bool Standby { get; set; }

Status

Get the status register from the sensor

View Source
public byte Status { get; }

DefaultI2cAddress

The default I2C address for the peripheral

View Source
public byte DefaultI2cAddress { get; }

Methods

ReadSensor()

Update the temperature and pressure from the sensor and set the Pressure property.

View Source
protected override Task<(Temperature? Temperature, Pressure? Pressure)> ReadSensor()
Returns

System.Threading.Tasks.Task<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>

RaiseEventsAndNotify(IChangeResult<(Temperature? Temperature, Pressure? Pressure)>)

Inheritance-safe way to raise events and notify observers.

View Source
protected override void RaiseEventsAndNotify(IChangeResult<(Temperature? Temperature, Pressure? Pressure)> changeResult)
Parameters
TypeName
Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>changeResult

Reset()

Reset the sensor

View Source
public void Reset()

Implements

  • System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>>
  • Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>
  • Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Pressure>>>
  • System.IDisposable
  • Meadow.Peripherals.Sensors.ITemperatureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.Atmospheric.IBarometricPressureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Pressure>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Pressure>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral