diff options
Diffstat (limited to 'esp/src/bmp280.cpp')
| -rw-r--r-- | esp/src/bmp280.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/esp/src/bmp280.cpp b/esp/src/bmp280.cpp new file mode 100644 index 0000000..0ba749a --- /dev/null +++ b/esp/src/bmp280.cpp @@ -0,0 +1,20 @@ +#include <Wire.h> +#include <Adafruit_BMP280.h> +#include "bmp280.h" + +Adafruit_BMP280 bmp; + +void setupBMP280() { + if (!bmp.begin(0x76)) { + Serial.println("BMP280 nao achado"); + while (1); + } +} + +float lerTemperaturaBMP280() { + return bmp.readTemperature(); +} + +float lerPressaoBMP280() { + return bmp.readPressure() / 100.0F; +} |
