HoangDanhNguyen.40270
#include
#include
#include "U8glib.h"
#include
#define DHTPIN 4 // what pin we're connected to
#define DHTTYPE DHT22 // DHT 22 (AM2302)
DHT dht(DHTPIN, DHTTYPE);
float hum = 0;
float tem = 0;
DS3231 rtc(SDA, SCL);
Time t;
U8GLIB_ST7920_128X64 u8g(13, 11, 10, U8G_PIN_NONE);//RW-PIN 11,E-PIN 13-RS PIN 10
void getTemperature()
{
hum = dht.readHumidity();
tem = dht.readTemperature();
}
void draw(void) {
/*u8g.setFont(u8g_font_helvB08);
u8g.setPrintPos(90, 10);
u8g.print("Clock");*/
t = rtc.getTime();
getTemperature();
u8g.setFont(u8g_font_helvB08);
u8g.setPrintPos(87, 40);
u8g.print(tem);
u8g.setFont(u8g_font_helvB08);
u8g.setPrintPos(115, 40);
u8g.print("*C");
u8g.setFont(u8g_font_helvB08);
u8g.setPrintPos(87, 57);
u8g.print(hum);
//u8g.setFont(u8g_font_helvB08);
u8g.setFont(u8g_font_unifont);
u8g.setPrintPos(116, 57);
u8g.print("%");
///////////////////hthi gio phut giay/////////////////////
if(t.hour