/* Sketch was generated by motoblockly
Website: http://www.motoblockly.com
Author: www.motoduino.com
Date: Sat Dec 09 2023 18:58:54 GMT+0800
*/
#include <U8g2lib.h>
#include "DHT.h"
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, /* reset=*/ U8X8_PIN_NONE);
DHT dht(13, DHT22);
float temp=0;
void setup()
{
pinMode(13, INPUT);
dht.begin();
u8g2.begin();
u8g2.setFont(u8g2_font_ncenB10_tr);
u8g2.setFont(u8g2_font_ncenB08_tr);
u8g2.enableUTF8Print();
u8g2.setFont(u8g2_font_unifont_t_chinese2);
}
void loop()
{
u8g2.clear();
temp = dht.readTemperature();
u8g2.setCursor(0,10);
u8g2.print(String("溫度:") + String(temp));
u8g2.sendBuffer();
}