-
-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathMS5611_performance.ino
72 lines (53 loc) · 1.18 KB
/
MS5611_performance.ino
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
//
// FILE: MS5611_performance.ino
// AUTHOR: Rob Tillaart
// PURPOSE: demo application
// DATE: 2020-06-21
// URL: https://github.com/RobTillaart/MS5611
#include "MS5611.h"
MS5611 MS5611(0x76); // 0x76 = CSB to VCC; 0x77 = CSB to GND
uint32_t start, stop, count;
void setup()
{
Serial.begin(115200);
while(!Serial);
Serial.println();
Serial.println(__FILE__);
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.");
while (1);
}
Serial.println();
count = 0;
}
void loop()
{
delay(1000);
start = micros();
int result = MS5611.read(); // uses default OSR_ULTRA_LOW (fastest)
stop = micros();
if (count % 20 == 0)
{
Serial.println();
Serial.println("CNT\tDUR\tRES\tTEMP\tPRES");
}
Serial.print(count);
count++;
Serial.print("\t");
Serial.print(stop - start);
Serial.print("\t");
Serial.print(result);
Serial.print("\t");
Serial.print(MS5611.getTemperature(), 2);
Serial.print("\t");
Serial.print(MS5611.getPressure(), 2);
Serial.println();
}
// -- END OF FILE --