Created
July 4, 2020 02:30
-
-
Save toyoshi/d12adac94e1acbe02b86deab2d6c5d1b 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 <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