Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections:

Characteristic Locus
Inheritance object ObservableBase<Temperature> SamplingSensorBase<Temperature> PollingSensorBase<Temperature> ByteCommsSensorBase<Temperature> > Tmp102
Implements IObservable<IChangeResult<Temperature>> IDisposable ITemperatureSensor ISamplingSensor<Temperature> ISensor<Temperature> II2cPeripheral
Inherited Members ByteCommsSensorBase<Temperature>.Init(int, int) ByteCommsSensorBase<Temperature>.Dispose(bool) ByteCommsSensorBase<Temperature>.Dispose() ByteCommsSensorBase<Temperature>.BusComms ByteCommsSensorBase<Temperature>.ReadBuffer ByteCommsSensorBase<Temperature>.WriteBuffer PollingSensorBase<Temperature>.StartUpdating(TimeSpan?) PollingSensorBase<Temperature>.StopUpdating() SamplingSensorBase<Temperature>.samplingLock SamplingSensorBase<Temperature>.RaiseEventsAndNotify(IChangeResult<Temperature>) SamplingSensorBase<Temperature>.Read() SamplingSensorBase<Temperature>.SamplingTokenSource SamplingSensorBase<Temperature>.Conditions SamplingSensorBase<Temperature>.IsSampling SamplingSensorBase<Temperature>.UpdateInterval SamplingSensorBase<Temperature>.Updated ObservableBase<Temperature>.NotifyObservers(IChangeResult<Temperature>) ObservableBase<Temperature>.Subscribe(IObserver<IChangeResult<Temperature>>) ObservableBase<Temperature>.CreateObserver(Action<IChangeResult<Temperature>>, Predicate<IChangeResult<Temperature>>) ObservableBase<Temperature>.observers object.Equals(object) object.Equals(object, object) object.GetHashCode() object.GetType() object.MemberwiseClone() object.ReferenceEquals(object, object) object.ToString()
Namespace Meadow.Foundation.Sensors.Temperature
Assembly Tmp102.dll

Syntax

public class Tmp102 : ByteCommsSensorBase<Temperature>, IObservable<IChangeResult<Temperature>>, IDisposable, ITemperatureSensor, ISamplingSensor<Temperature>, ISensor<Temperature>, II2cPeripheral

Constructors

Tmp102(II2cBus, byte)

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

Declaration
public Tmp102(II2cBus i2cBus, byte address = 72)

Parameters

Type Name Description
II2cBus i2cBus

The I2CBus

byte address

I2C address of the sensor

Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections:

Properties

DefaultI2cAddress

The default I2C address for the peripheral

Declaration
public byte DefaultI2cAddress { get; }

Property Value

Type Description
byte

Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections:

SensorResolution

Get / set the resolution of the sensor

Declaration
public Tmp102.Resolution SensorResolution { get; set; }

Property Value

Type Description
Tmp102.Resolution

Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections:

Temperature

The temperature from the last reading

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

Property Value

Type Description
Temperature?

Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections:

Methods

RaiseChangedAndNotify(IChangeResult<Temperature>)

Raise change events for subscribers

Declaration
protected void RaiseChangedAndNotify(IChangeResult<Temperature> changeResult)

Parameters

Type Name Description
IChangeResult<Temperature> changeResult

The change result with the current sensor data

Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections:

ReadSensor()

Update the Temperature property

Declaration
protected override Task<Temperature> ReadSensor()

Returns

Type Description
Task<Temperature>

Overrides

Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections:

Events

TemperatureUpdated

Raised when the temperature value changes

Declaration
public event EventHandler<IChangeResult<Temperature>> TemperatureUpdated

Event Type

Type Description
EventHandler<IChangeResult<Temperature>>

Remarks

Tmp102
Status Status badge: working
Source code GitHub
Datasheet(s) GitHub
NuGet package NuGet Gallery for Meadow.Foundation.Sensors.Temperature.Tmp102

The TMP102 is a temperature sensor capable of reading the current temperature with an accuracy of 0.5C over the range of -25C to 85C with a total range of -40C to 125C.

Purchasing

TMP102 sensors are available on a breakout board from the following suppliers:

The TMP102 temperature sensor can operate in interrupt or polling mode.

Code Example

Tmp102 tmp102;

public override Task Initialize()
{
    Resolver.Log.Info("Initialize...");

    tmp102 = new Tmp102(Device.CreateI2cBus());

    var consumer = Tmp102.CreateObserver(
        handler: result =>
        {
            Resolver.Log.Info($"Temperature New Value { result.New.Celsius}C");
            Resolver.Log.Info($"Temperature Old Value { result.Old?.Celsius}C");
        },
        filter: null
    );
    tmp102.Subscribe(consumer);

    tmp102.TemperatureUpdated += (object sender, IChangeResult<Meadow.Units.Temperature> e) =>
    {
        Resolver.Log.Info($"Temperature Updated: {e.New.Celsius:N2}C");
    };

    return Task.CompletedTask;
}

public override async Task Run()
{
    var temp = await tmp102.Read();
    Resolver.Log.Info($"Current temperature: {temp.Celsius} C");

    tmp102.StartUpdating(TimeSpan.FromSeconds(1));
}

Sample project(s) available on GitHub

Interrupt Mode

The example below will check the temperature every second. An interrupt will be raised if the difference in temperature between the last reported reading and the current reading is greater than + / - 0.1 °C.

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
        Console.WriteLine("TMP102 Interrupt Sample");

        // Create a new TMP102 object, check the temperature every
        // 1s and report any changes grater than +/- 0.1C.
        var tmp102 = new TMP102(updateInterval: 1000, temperatureChangeNotificationThreshold: 0.1F);

        // Hook up the interrupt handler.
        tmp102.TemperatureChanged += (s, e) =>
        {
            Console.WriteLine("Temperature: " + e.CurrentValue.ToString("f2"));
        };

        // Now put the main program to sleep as the interrupt handler
        // above deals with processing the sensor data.
        Thread.Sleep(Timeout.Infinite);
    }
}

Polling Mode

The following application reads the temperature from the TMP102 sensor every second and displays the results in the debug console:

public class MeadowApp : App<F7Micro, MeadowApp>
{
    public MeadowApp()
    {
      gi  Console.WriteLine("TMP102 Test");
        var tmp102 = new TMP102();
        while (true)
        {
            Console.WriteLine("Temperature: " + tmp102.Temperature.ToString("f2"));
            Thread.Sleep(1000);
        }
    }
}

Sample projects available on GitHub

Wiring Example

TMP102 sensors can be connected to Meadow using only four connections: