Skip to main content

Meadow.Foundation.Sensors.Atmospheric.AdafruitMPRLS

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

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:

MPRLSMeadow Pin
GNDGND
VCC3.3V
SCLD08
SDAD07