Meadow.Foundation.Sensors.Atmospheric.AdafruitMPRLS
AdafruitMPRLS | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
Code Example
AdafruitMPRLS sensor;
public override Task Initialize()
{
Resolver.Log.Info("Initializing...");
sensor = new AdafruitMPRLS(Device.CreateI2cBus());
sensor.Updated += PressureSensor_Updated;
return Task.CompletedTask;
}
public override Task Run()
{
sensor.StartUpdating(TimeSpan.FromSeconds(1));
return Task.CompletedTask;
}
void PressureSensor_Updated(object sender, IChangeResult<(Pressure? Pressure, Pressure? RawPsiMeasurement)> result)
{
Resolver.Log.Info($"New pressure PSI: {result.New.Pressure?.Psi}, Old pressure PSI: {result.Old?.Pressure?.Psi}");
Resolver.Log.Info($"Pressure in Pascal: {result.New.Pressure?.Pascal}");
Resolver.Log.Info($"Raw sensor value: {result.New.RawPsiMeasurement?.Psi}");
}
Sample project(s) available on GitHub
Wiring Example
To wire a Adafruit MPRLS Sensor to your Meadow board, connect the following:
MPRLS | Meadow Pin |
---|---|
GND | GND |
VCC | 3.3V |
SCL | D08 |
SDA | D07 |