#include <U8g2lib.h>
#include <Wire.h>
#define SCREEN_WIDTH 128
#define SCREEN_HEIGHT 64
#define SCREEN_ADDRESS 0x3C
unsigned long epochTime;
bool wifi_state = 0, day_night_state;
float temp_inside_value, temp_outside_value, ldr_value;
uint8_t hour_input, minus_input, second_input, now_hours, now_minus, now_second;
int screen_count = 0;
bool button_button1_check = 0, screen_check = 1, button_button2_check = 0 , button_button3_check = 0 , mode = 0;
int brightness_yellow = 40, brightness_white = 40, yellow_brightness_value, white_brightness_value; // tạo các biến ghi nhớ các giá trị đầu vào đầu ra, điều khiển
U8G2_SSD1306_128X64_NONAME_F_HW_I2C u8g2(U8G2_R0, U8X8_PIN_NONE); // cấu hình màn hình
void setup() {
u8g2.begin();
}
void loop() {
u8g2.clearBuffer();
u8g2.setFont(u8g2_font_baby_tf);
u8g2.drawStr(7, 7, "Light mode:");
if(mode == 0) u8g2.drawStr(58, 7,"auto");
if(mode == 1) u8g2.drawStr(58, 7,"manual");
u8g2.setFont(u8g2_font_open_iconic_www_1x_t); // hàm gọi kiểu font chữ trong thư viện u8g2
u8g2.drawGlyph(110, 11, 72);
u8g2.setFont(u8g2_font_open_iconic_weather_4x_t);
if(day_night_state == 0)u8g2.drawGlyph(80, 50, 66); //ngay
if(day_night_state == 1)u8g2.drawGlyph(80, 50, 69); //dem
u8g2.setFont(u8g2_font_5x8_t_cyrillic);
u8g2.drawStr(10, 25, "Nhiet do:");
u8g2.setFont(u8g2_font_7x14_mf);
u8g2.setCursor(10, 40);
u8g2.print(temp_inside_value);
u8g2.drawGlyph(50, 40, 0x00b0);
u8g2.drawStr(60, 40, "C");
u8g2.setFont(u8g2_font_open_iconic_embedded_1x_t);
u8g2.drawGlyph(10, 64, 66);
u8g2.drawGlyph(60, 64, 75);
u8g2.drawGlyph(110, 64, 77);
u8g2.sendBuffer();
}