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>
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 current temperature
View Source
public Temperature? Temperature { get; }
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
Type | Name |
---|---|
System.Byte | resolution |
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