Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
#include <M5StickC.h>
#include <Wire.h> //The DHT12 uses I2C comunication.
#include "Adafruit_Sensor.h"
#include "DHT12.h"
DHT12 dht12;
float env_tmp = 0.0;
float envhat_tmp = 0.0;
void setup() {
M5.begin();
M5.Lcd.setRotation(3);
}
void loop() {
Wire.begin(32, 33, 100000);
env_tmp = dht12.readTemperature();
Wire.begin(0,26);
envhat_tmp = dht12.readTemperature();
Serial.printf("%2.2f,%2.2f\r\n", env_tmp, envhat_tmp);
M5.Lcd.setCursor(0, 0);
M5.Lcd.setTextColor(WHITE, BLACK);
M5.Lcd.printf("ENV temp: %2.2f\r\nENV HAT temp: %2.2f\r\n", env_tmp, envhat_tmp);
delay(1000 * 60 * 3);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment