In this example we will install bme280 driver:
$ nuget install Meadow.Foundation.Sensors.Atmospheric.Bme280
Next we need to edit our Blink.csproj to use it:
<ItemGroup>
<PackageReference Include="Meadow.F7" Version="*" />
<PackageReference Include="Meadow.Foundation" Version="*" />
<PAckageReference Include="Meadow.Foundation.Sensors.Atmospheric.Bme280" Version="*" />
</ItemGroup>
This is an example to use bme280:
using Meadow;
using Meadow.Devices;
using Meadow.Foundation;
using Meadow.Foundation.Leds;
using Meadow.Peripherals.Leds;
using Meadow.Units;
using Meadow.Foundation.Sensors.Atmospheric;
using System;
using System.Threading.Tasks;
namespace MeadowApp
{
// Change F7FeatherV2 to F7FeatherV1 for V1.x boards
public class MeadowApp : App<F7FeatherV2>
{
Bme280 _bme280;
public override Task Initialize()
{
Resolver.Log.Info("Initialize...");
var i2cBus = Device.CreateI2cBus();
_bme280 = new Bme280(i2cBus);
return base.Initialize();
}
public override Task Run()
{
Resolver.Log.Info("Run...");
_bme280.StartUpdating();
while (true)
{
Resolver.Log.Info($"{_bme280.Pressure.GetValueOrDefault(new Pressure(0, Pressure.UnitType.Psi)).Psi}");
//await Task.Delay(1000);
}
}
}
}