Skip to content

Commit

Permalink
add example for usage on Arduino Nano
Browse files Browse the repository at this point in the history
  • Loading branch information
hasenradball committed Feb 25, 2022
1 parent 809f16c commit a35c8e4
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 1 deletion.
31 changes: 31 additions & 0 deletions examples/Arduino_Nano_example.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#include <Arduino.h>
#include <Bosch_BME280_Arduino.h>

BME::Bosch_BME280 bme{-1, -1, 0x77, 249.67F, true};

void setup() {
Serial.begin(115200);
while (!Serial) {
yield();
}

// init Bosch BME 280 Sensor
if (bme.begin() != 0) {
Serial.println("\n\t>>> ERROR: Init of Bosch BME280 Sensor failed! <<<");
}
}

void loop() {
static unsigned long tic {millis()};
unsigned long ms = millis();
if (ms - tic >= 2000) {
tic = ms;
bme.measure();
Serial.print("\n\tTemperature:\t");
Serial.println(bme.getTemperature());
Serial.print("\tHumidity:\t");
Serial.println(bme.getHumidity());
Serial.print("\tPressure at NN:\t");
Serial.println(bme.getSealevelForAltitude());
}
}
2 changes: 1 addition & 1 deletion library.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "Bosch_BME280_Arduino",
"version": "0.0.3",
"version": "0.0.4",
"description": "Arduino Wrapper Class for use of BME280 Sensor based on the original Bosch Sensortec Driver",
"keywords": ["temperature", "humidity", "pressure", "bme280", "Bosch", "Sensortec"],
"authors":
Expand Down

0 comments on commit a35c8e4

Please sign in to comment.