Skip to content

Instantly share code, notes, and snippets.

@toyoshi
Created July 4, 2020 02:30
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 toyoshi/d12adac94e1acbe02b86deab2d6c5d1b to your computer and use it in GitHub Desktop.
Save toyoshi/d12adac94e1acbe02b86deab2d6c5d1b to your computer and use it in GitHub Desktop.
#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