2014-10-19 07:00:16 -04:00
|
|
|
//
|
2020-11-27 05:20:37 -05:00
|
|
|
// FILE: MS5611_test.ino
|
2014-10-19 07:00:16 -04:00
|
|
|
// AUTHOR: Rob Tillaart
|
|
|
|
// PURPOSE: demo application
|
|
|
|
// DATE: 2014-okt-16
|
2020-11-27 05:20:37 -05:00
|
|
|
// URL: https://github.com/RobTillaart/MS5611
|
2014-10-19 07:00:16 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
2014-10-19 07:00:16 -04:00
|
|
|
#include "MS5611.h"
|
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
MS5611 MS5611(0x77); // 0x76 = CSB to VCC; 0x77 = CSB to GND
|
2014-10-19 07:00:16 -04:00
|
|
|
|
|
|
|
void setup()
|
|
|
|
{
|
2020-11-27 05:20:37 -05:00
|
|
|
Serial.begin(115200);
|
|
|
|
Serial.print(__FILE__);
|
|
|
|
Serial.print("MS5611 lib version: ");
|
|
|
|
Serial.println(MS5611_LIB_VERSION);
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
bool b = MS5611.begin();
|
|
|
|
Serial.println(b ? "found" : "not found");
|
2014-10-19 07:00:16 -04:00
|
|
|
}
|
|
|
|
|
|
|
|
void loop()
|
|
|
|
{
|
2020-11-27 05:20:37 -05:00
|
|
|
int result = MS5611.read();
|
|
|
|
if (result != MS5611_READ_OK)
|
|
|
|
{
|
|
|
|
Serial.print("Error in read: ");
|
|
|
|
Serial.println(result);
|
|
|
|
}
|
|
|
|
else
|
|
|
|
{
|
|
|
|
Serial.print("T:\t");
|
2021-01-29 06:31:58 -05:00
|
|
|
Serial.print(MS5611.getTemperature(), 2);
|
2020-11-27 05:20:37 -05:00
|
|
|
Serial.print("\tP:\t");
|
2021-01-29 06:31:58 -05:00
|
|
|
Serial.print(MS5611.getPressure(), 2);
|
2020-11-27 05:20:37 -05:00
|
|
|
}
|
2014-10-19 07:00:16 -04:00
|
|
|
|
2021-01-29 06:31:58 -05:00
|
|
|
delay(1000);
|
2020-11-27 05:20:37 -05:00
|
|
|
}
|
2021-01-29 06:31:58 -05:00
|
|
|
|
|
|
|
// -- END OF FILE --
|