Remarks

Lm75
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Lm75

Code Example

Lm75 lm75;

public MeadowApp()
{
    lm75 = new Lm75(Device.CreateI2cBus());

    TestRead().Wait();

      Console.WriteLine("TestUpdating...");

    var consumer = Lm75.CreateObserver(
        handler: result =>
        {
            Console.WriteLine($"Temperature New Value { result.New.Celsius}C");
            Console.WriteLine($"Temperature Old Value { result.Old?.Celsius}C");
              },
        filter: null
    );
    lm75.Subscribe(consumer);

    lm75.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Console.WriteLine($"Temperature Updated: {e.New.Celsius:n2}C");
    };

    lm75.StartUpdating();
}

Sample project(s) available on GitHub

Characteristic Locus
Inheritance System.Object ObservableBase<Units.Temperature> SensorBase<Units.Temperature> SamplingSensorBase<Units.Temperature> ByteCommsSensorBase<Units.Temperature> > Lm75
Implements IDisposable ITemperatureSensor
Inherited Members ByteCommsSensorBase<Units.Temperature>.Peripheral ByteCommsSensorBase<Units.Temperature>.ReadBuffer ByteCommsSensorBase<Units.Temperature>.WriteBuffer ByteCommsSensorBase<Units.Temperature>.Init(Int32, Int32) ByteCommsSensorBase<Units.Temperature>.Dispose(Boolean) ByteCommsSensorBase<Units.Temperature>.Dispose() SamplingSensorBase<Units.Temperature>.StartUpdating(Nullable<TimeSpan>) SamplingSensorBase<Units.Temperature>.StopUpdating() SensorBase<Units.Temperature>.Updated SensorBase<Units.Temperature>.samplingLock SensorBase<Units.Temperature>.SamplingTokenSource SensorBase<Units.Temperature>.Conditions SensorBase<Units.Temperature>.IsSampling SensorBase<Units.Temperature>.UpdateInterval SensorBase<Units.Temperature>.RaiseEventsAndNotify(IChangeResult<Units.Temperature>) SensorBase<Units.Temperature>.Read() ObservableBase<Units.Temperature>.observers ObservableBase<Units.Temperature>.NotifyObservers(IChangeResult<Units.Temperature>) Meadow.Foundation.ObservableBase<Units.Temperature>.Subscribe(IObserver<>) Meadow.Foundation.ObservableBase<Units.Temperature>.CreateObserver(Action<>, System.Nullable<Predicate<Meadow.IChangeResult<UNIT>>>)
Namespace Meadow.Foundation.Sensors.Temperature
Assembly Lm75.dll

Syntax

public class Lm75 : ByteCommsSensorBase<Units.Temperature>, IDisposable, ITemperatureSensor

Constructors

Lm75(II2cBus, Byte)

Create a new TMP102 object using the default configuration for the sensor.

Declaration
public Lm75(II2cBus i2cBus, byte address = null)

Parameters

Type Name Description
II2cBus i2cBus
System.Byte address

I2C address of the sensor.

Properties

Temperature

The Temperature value from the last reading.

Declaration
public Units.Temperature? Temperature { get; protected set; }

Property Value

Type Description
System.Nullable<Units.Temperature>

Methods

RaiseEventsAndNotify(IChangeResult<Units.Temperature>)

Declaration
protected override void RaiseEventsAndNotify(IChangeResult<Units.Temperature> changeResult)

Parameters

Type Name Description
IChangeResult<Units.Temperature> changeResult

ReadSensor()

Update the Temperature property.

Declaration
protected override Task<Units.Temperature> ReadSensor()

Returns

Type Description
Task<Units.Temperature>

Overrides

Meadow.Foundation.SensorBase<Units.Temperature>.ReadSensor()

Events

TemperatureUpdated

Raised when the value of the reading changes.

Declaration
public event EventHandler<IChangeResult<Units.Temperature>> TemperatureUpdated

Event Type

Type Description
EventHandler<IChangeResult<Units.Temperature>>