Skip to content

Instantly share code, notes, and snippets.

@hatsunea
Created June 7, 2021 15:26
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save hatsunea/424a098192a96fd62d181841b109a827 to your computer and use it in GitHub Desktop.
Save hatsunea/424a098192a96fd62d181841b109a827 to your computer and use it in GitHub Desktop.
#include "Adafruit_Sensor.h"
#include <Adafruit_BMP280.h>
#include <M5Core2.h>
#include <Wire.h>
#include "SHT3X.h"
SHT3X Sht30; // I2C
Adafruit_BMP280 Bmp; // I2C
float Tmp = 0.0;
float Hum = 0.0;
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();
if(Sht30.get()==0) {
Tmp = Sht30.cTemp;
Hum = Sht30.humidity;
}
Serial.printf("Temperatura: %2.2f*C Humedad: %0.2f%% Pressure: %0.2fPa\r\n", Tmp, Hum, Pressure);
M5.Lcd.setCursor(0, 0);
M5.Lcd.setTextColor(WHITE, BLACK);
M5.Lcd.printf("Temp: %2.1f \r\nHumi: %2.0f%% \r\nPressure:%2.0fPa\r\n", Tmp, Hum, Pressure);
delay(100);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment