GY-63_MS5611/libraries/MS5611/examples/MS5611_minimal/MS5611_minimal.ino

68 lines
1.3 KiB
Arduino
Raw Normal View History

2021-12-24 06:14:45 -05:00
//
// FILE: MS5611_minimal.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo application
// DATE: 2021-12-24
// URL: https://github.com/RobTillaart/MS5611
#include "MS5611.h"
2022-01-23 08:56:48 -05:00
// BREAKOUT MS5611 aka GY63 - see datasheet
//
// SPI I2C
// +--------+
// VCC VCC | o |
// GND GND | o |
// SCL | o |
// SDI SDA | o |
// CSO | o |
// SDO | o L | L = led
// PS | o O | O = opening PS = protocol select
// +--------+
//
// PS to VCC ==> I2C (GY-63 board has internal pull up, so not needed)
// PS to GND ==> SPI
// CS to VCC ==> 0x76
// CS to GND ==> 0x77
MS5611 MS5611(0x77);
2021-12-24 06:14:45 -05:00
void setup()
{
Serial.begin(115200);
2022-01-14 07:34:56 -05:00
while(!Serial);
Serial.println();
Serial.println(__FILE__);
2021-12-24 06:14:45 -05:00
Serial.print("MS5611_LIB_VERSION: ");
Serial.println(MS5611_LIB_VERSION);
if (MS5611.begin() == true)
{
Serial.println("MS5611 found.");
}
else
{
Serial.println("MS5611 not found. halt.");
2022-01-14 07:34:56 -05:00
while (1);
2021-12-24 06:14:45 -05:00
}
2022-01-14 07:34:56 -05:00
Serial.println();
2021-12-24 06:14:45 -05:00
}
void loop()
{
MS5611.read(); // note no error checking => "optimistic".
2022-01-14 07:34:56 -05:00
Serial.print("T:\t");
2021-12-24 06:14:45 -05:00
Serial.print(MS5611.getTemperature(), 2);
Serial.print("\tP:\t");
Serial.print(MS5611.getPressure(), 2);
2022-01-14 07:34:56 -05:00
Serial.println();
2021-12-24 06:14:45 -05:00
delay(1000);
}
// -- END OF FILE --