Skip to content

Instantly share code, notes, and snippets.

@hatsunea

hatsunea/Env2Unit_BMP.ino

Last active Jun 7, 2021
Embed
What would you like to do?
#include "Adafruit_Sensor.h"
#include <Adafruit_BMP280.h>
#include <M5Core2.h>
#include <Wire.h>
Adafruit_BMP280 Bmp; // I2C
float Pressure = 0.0;
void setup() {
M5.begin();
Wire.begin();
M5.Lcd.setTextSize(3);
while (!Bmp.begin(0x76)) {
Serial.println("Could not find a valid BMP280 sensor, check wiring!");
M5.Lcd.println("Could not find a valid BMP280 sensor, check wiring!");
}
M5.Lcd.clear(BLACK);
M5.Lcd.println("ENV.II Unit test...");
}
void loop() {
Pressure = Bmp.readPressure();
Serial.printf("Pressure: %0.2fPa\r\n", pressure);
M5.Lcd.setCursor(0, 0);
M5.Lcd.setTextColor(WHITE, BLACK);
M5.Lcd.printf("Pressure:%2.0fPa\r\n", pressure);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment