Skip to content

Instantly share code, notes, and snippets.

@hatsunea
Last active June 7, 2021 14:21
Show Gist options
  • Save hatsunea/60f0f109959c9b3c5ac88e258b03ec49 to your computer and use it in GitHub Desktop.
Save hatsunea/60f0f109959c9b3c5ac88e258b03ec49 to your computer and use it in GitHub Desktop.
#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