Created
June 7, 2021 15:26
-
-
Save hatsunea/424a098192a96fd62d181841b109a827 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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