Skip to main content

Class Mcp9808

Represents a Mcp9808 temperature sensor

Assembly: Mcp9808.dll
View Source
Declaration
public class Mcp9808 : ByteCommsSensorBase<Temperature>, IObservable<IChangeResult<Temperature>>, IDisposable, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, ISensor, ISamplingSensor, II2cPeripheral

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

Implements:
System.IObservable<Meadow.IChangeResult<Meadow.Units.Temperature>>, System.IDisposable, Meadow.Peripherals.Sensors.ITemperatureSensor, Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>, Meadow.Peripherals.Sensors.ISensor, Meadow.Peripherals.Sensors.ISamplingSensor, Meadow.Hardware.II2cPeripheral

Properties

DefaultI2cAddress

The default I2C address for the peripheral

View Source
Declaration
public byte DefaultI2cAddress { get; }

Temperature

The current temperature

View Source
Declaration
public Temperature? Temperature { get; }

Methods

Wake()

Wake the device if it's in sleep state

View Source
Declaration
public void Wake()

Sleep()

Set the device into a low power sleep state

View Source
Declaration
public void Sleep()

GetDeviceId()

Read the device ID

View Source
Declaration
public ushort GetDeviceId()
Returns

System.UInt16

GetManufactureId()

Read the manufacture ID

View Source
Declaration
public ushort GetManufactureId()
Returns

System.UInt16

GetResolution()

Read resolution

View Source
Declaration
public byte GetResolution()
Returns

System.Byte

SetResolution(byte)

Set resolution

View Source
Declaration
public void SetResolution(byte resolution)
Parameters
TypeName
System.Byteresolution

ReadSensor()

Reads data from the sensor

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

System.Threading.Tasks.Task<Meadow.Units.Temperature>: The latest sensor reading

Implements

  • System.IObservable<Meadow.IChangeResult<Meadow.Units.Temperature>>
  • System.IDisposable
  • Meadow.Peripherals.Sensors.ITemperatureSensor
  • Meadow.Peripherals.Sensors.ISamplingSensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor<Meadow.Units.Temperature>
  • Meadow.Peripherals.Sensors.ISensor
  • Meadow.Peripherals.Sensors.ISamplingSensor
  • Meadow.Hardware.II2cPeripheral