ESP8266 WiFi घड़ी
ESP8266 WiFi 시계
ESP8266과 OLED 디스플레이로 NTP 시계를 만듭니다.
부품 목록
| 부품 | 모델 |
|---|---|
| MCU | ESP8266MOD (Ideaspark) |
| 디스플레이 | 0.96" OLED SSD1306 |
| 프로토콜 | I2C |
핵심 코드
#include <ESP8266WiFi.h>
#include <NTPClient.h>
#include <Wire.h>
#include <Adafruit_SSD1306.h>
WiFiUDP ntpUDP;
NTPClient timeClient(ntpUDP, "pool.ntp.org", 32400); // KST
void setup() {
WiFi.begin(ssid, password);
timeClient.begin();
display.begin(SSD1306_SWITCHCAPVCC, 0x3C);
}
void loop() {
timeClient.update();
display.clearDisplay();
display.setTextSize(2);
display.println(timeClient.getFormattedTime());
display.display();
delay(1000);
}
추가 기능
- 웹 대시보드 (ESP8266WebServer)
- mDNS (clock.local)
- WiFi 재접속 로직