Skip to main content

Meadow.Foundation.Sensors.Temperature.Adt7410

Adt7410
StatusStatus badge: working
Source codeGitHub
Datasheet(s)GitHub
NuGet packageNuGet Gallery for Meadow.Foundation.Sensors.Temperature.Adt7410

Code Example

Adt7410 adt7410;

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

adt7410 = new Adt7410(Device.CreateI2cBus());
adt7410.SensorResolution = Adt7410.Resolution.Resolution13Bits;

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

adt7410.Updated += (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 adt7410.Read();
Resolver.Log.Info($"Current temperature: {temp.Celsius}C");

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

Sample project(s) available on GitHub