-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathSimple.ino
45 lines (40 loc) · 1.09 KB
/
Simple.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
//****************************************************************************//
//
// pocketBME280 Library
// Axel Grewe - [email protected] 12-Sep-2022
//
// Example for basic usage of library
//
//****************************************************************************//
#include <pocketBME280.h>
pocketBME280 mySensor;
void setup() {
Serial.begin(115200);
Serial.println("Initializing BME280 Sensor");
if (!mySensor.begin()) {
Serial.println("No BME280 sensor. Check wiring.");
while (1)
; //Freeze
}
}
void loop() {
mySensor.startMeasurement();
while (!mySensor.isMeasuring()) {
Serial.println("Waiting for Measurement to start");
delay(1);
}
while (mySensor.isMeasuring()) {
Serial.println("Measurement in progress");
delay(1);
}
Serial.print("Temperature: ");
Serial.print(mySensor.getTemperature() / 100.);
Serial.println("°C");
Serial.print("Pressure: ");
Serial.print(mySensor.getPressure());
Serial.println(" Pa");
Serial.print("Humidity: ");
Serial.print(mySensor.getHumidity() / 1024.);
Serial.println("%rH");
delay(5000);
}