Meadow.Foundation.Sensors.Temperature.Mcp9600
Mcp9600 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
Mcp9600 sensor;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
sensor = new Mcp9600(Device.CreateI2cBus());
var consumer = Mcp9600.CreateObserver(
handler: result =>
{
Resolver.Log.Info($"Temperature New Value {result.New.TemperatureHot.Value.Celsius}C");
},
filter: null
);
sensor.Subscribe(consumer);
sensor.Updated += Sensor_Updated;
return Task.CompletedTask;
}
private void Sensor_Updated(object sender, IChangeResult<(Meadow.Units.Temperature? TemperatureHot, Meadow.Units.Temperature? TemperatureCold)> e)
{
Resolver.Log.Info($"Temperature hot: {e.New.TemperatureHot.Value.Celsius:n2}C, Temperature cold: {e.New.TemperatureCold.Value.Celsius:n2}C");
}
public override Task Run()
{
sensor.StartUpdating();
return Task.CompletedTask;
}
Sample project(s) available on GitHub
Class Mcp9600
Represents a Mcp9600 Thermocouple sensor object
Assembly: Mcp960x.dll
View Source
public class Mcp9600 : Mcp960x, IObservable<IChangeResult<(Temperature? TemperatureHot, Temperature? TemperatureCold)>>, ISamplingSensor<(Temperature? TemperatureHot, Temperature? TemperatureCold)>, ISensor<(Temperature? TemperatureHot, Temperature? TemperatureCold)>, IDisposable, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, ISensor, ISamplingSensor, II2cPeripheral
Inheritance: System.Object
-> Meadow.Foundation.ObservableBase<UNIT>
Implements:
Expand
System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>>
, Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>
, Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<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
Implements
System.IObservable<Meadow.IChangeResult<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>>
Meadow.Peripherals.Sensors.ISamplingSensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<Meadow.Units.Temperature>>>
Meadow.Peripherals.Sensors.ISensor<System.ValueTuple<System.Nullable<Meadow.Units.Temperature>,System.Nullable<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