#include #include // provides ESP8266 specific Wi-Fi routines we are calling to connect to network #include //handles sending and receiving of UDP packages #include // SPI for interfacing OLED with NodeMCU #include Adafruit_SSD1306 oled(128, 64, &Wire, D0); const char *ssid = "*********"; const char *password = "*********"; WiFiUDP ntpUDP; NTPClient timeClient(ntpUDP, "pool.ntp.org", 19800,60000); String arr_days[]={"Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"}; String date_time; // You can specify the time server pool and the offset (in seconds, can be // changed later with setTimeOffset() ). Additionaly you can specify the // update interval (in milliseconds, can be changed using setUpdateInterval() ). void setup() { Serial.begin(115200); WiFi.begin(ssid, password); while ( WiFi.status() != WL_CONNECTED ) { delay ( 500 ); Serial.print ( "." ); } if(!oled.begin(SSD1306_SWITCHCAPVCC, 0x3C)) { Serial.println(F("SSD1306 allocation failed")); for(;;); // Don't proceed, loop forever } oled.clearDisplay(); oled.setTextSize(1); // Draw 2X-scale text oled.setTextColor(WHITE); oled.setCursor(5, 2); oled.println("AYUBOWAN.!"); oled.println("Prabuddha"); oled.println(" Srimal"); oled.display(); delay(3000); timeClient.begin(); } void loop() { timeClient.update(); oled.clearDisplay(); Serial.println(timeClient.getFormattedTime()); oled.setTextSize(3); // Draw 2X-scale text oled.setTextColor(WHITE); oled.setCursor(0, 2); int hh = timeClient.getHours(); int mm = timeClient.getMinutes(); int ss = timeClient.getSeconds(); if(hh>12) { hh=hh-12; oled.print(hh); oled.print(":"); oled.print(mm); oled.print(":"); oled.println("pm"); } else { oled.print(hh); oled.print(":"); oled.print(mm); oled.print(":"); oled.println("am"); } int day = timeClient.getDay(); oled.println(""+arr_days[day]+""); oled.display(); // Show initial text } //@ApePanthiya ICT