Skip to main content

Class Mcp9808

Represents a Mcp9808 temperature sensor

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

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

Temperature

The temperature, in degrees celsius (°C), from the last reading.

View Source
public Temperature? Temperature { get; protected set; }

Methods

Wake()

Wake the device if it's in sleep state

View Source
public void Wake()

Sleep()

Set the device into a low power sleep state

View Source
public void Sleep()

GetDeviceId()

Read the device ID

View Source
public ushort GetDeviceId()
Returns

System.UInt16

GetManufactureId()

Read the manufacture ID

View Source
public ushort GetManufactureId()
Returns

System.UInt16

GetResolution()

Read resolution

View Source
public byte GetResolution()
Returns

System.Byte

SetResolution(byte)

Set resolution

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

ReadSensor()

Reads data from the sensor

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