Remarks
Ms5611 | |
---|---|
Status | |
Source code | GitHub |
Datasheet(s) | GitHub |
NuGet package |
The MS5611 is a barometer and temperature sensor that communicates over I2C or SPI up to 20Mhz. Operating range: 10 to 1200 mbar, -40 to +85 °C.
Code Example
Ms5611 sensor;
public MeadowApp()
{
Console.WriteLine("Initializing...");
//CreateSpiSensor();
CreateI2CSensor();
while (true)
{
Thread.Sleep(1000);
Console.WriteLine(" Reading Temp...");
sensor.ReadTemperature();
Console.WriteLine(" Reading Pressure...");
sensor.ReadPressure();
Thread.Sleep(1000);
}
}
void CreateI2CSensor()
{
Console.WriteLine("MS5611 I2C Test");
sensor = new Ms5611(Device.CreateI2cBus());
}
void CreateSpiSensor()
{
Console.WriteLine("MS5611 SPI Test");
sensor = new Ms5611(Device.CreateSpiBus(), Device.Pins.D00);
}
Sample project(s) available on GitHub
Wiring Example
To wire a Ms5611 to your Meadow board, connect the following:
Ms5611 | Meadow Pin |
---|---|
GND | GND |
SCL | D08 (SCL) |
SDA | D07 (SDA) |
VCC | 3V3 |
It should look like the following diagram:
Characteristic | Locus |
---|---|
Inheritance | System.Object > Ms5611 |
Namespace | Meadow.Foundation.Sensors.Atmospheric |
Assembly | Ms5611.dll |
Syntax
public class Ms5611 : object
Constructors
Ms5611(II2cBus, Byte, Ms5611.Resolution)
Connect to the Ms5611 using I2C
Declaration
public Ms5611(II2cBus i2c, byte address = null, Ms5611.Resolution resolution = default(Ms5611.Resolution))
Parameters
Type | Name | Description |
---|---|---|
II2cBus | i2c | |
System.Byte | address | i2c address - default is 0x5c |
Ms5611.Resolution | resolution |
Ms5611(ISpiBus, IPin, Ms5611.Resolution)
Connect to the Ms5611 using SPI (PS must be pulled low)
Declaration
public Ms5611(ISpiBus spi, IPin chipSelect, Ms5611.Resolution resolution = default(Ms5611.Resolution))
Parameters
Type | Name | Description |
---|---|---|
ISpiBus | spi | |
IPin | chipSelect | |
Ms5611.Resolution | resolution |
Methods
ReadPressure()
Declaration
public int ReadPressure()
Returns
Type | Description |
---|---|
System.Int32 |
ReadTemperature()
Declaration
public int ReadTemperature()
Returns
Type | Description |
---|---|
System.Int32 |
Reset()
Declaration
public void Reset()