#include <Wire.h> //Calling of library for I2C interface.
#include <LiquidCrystal_I2C.h> //Calling of library for LCD display function with I2C.
#include <Adafruit_SSD1306.h> //Calling of library for OLED display function.
#include <Adafruit_GFX.h> //Calling of library for OLED display function.
#include <RTClib.h> //Calling of library for RTC module,s function
RTC_DS1307 Time; // An object creation for ds1307 RTC module.
LiquidCrystal_I2C lcd(0x27,16,2); // Set the LCD address to 0x27 for a 16 chars and 2 line display
Adafruit_SSD1306 display(128,64); // Set dimention of OLED display (128*64).
void setup() { // Set up function initialization.
lcd.init(); // Initialization of LCD display.
lcd.backlight(); // Command for flashing bak light of LCD.
display.begin(SSD1306_SWITCHCAPVCC, 0x3C); // Initialization of OLED display with 0x3C address.
Time.begin(); //Initialization of ds1307 module for real time.
} // Set up function closing.
void loop() { // Loop function initialization.
DateTime Real = Time.now(); // Object creation and calling a function of calculating the real time.
lcd.setCursor(0,0); // Selection of Starting position of LCD display.
lcd.print("Time = "); // Printing of text "Time" in LCD display.
lcd.print(Real.hour()); // Printing of hour in LCD display.
lcd.print(":");
lcd.print(Real.minute()); // Printing of minute in LCD display.
lcd.print(":");
lcd.print(Real.second()); // Printing of second in LCD display.
lcd.print(".");
display.clearDisplay(); // A command for clearing default text or picture in OLED display.
display.setCursor(15,0); // Selection of Starting position of OLED display.
display.setTextSize(3); // Selection of font size of text in OLED display.
display.setTextColor(SSD1306_WHITE); // Selection of color size of text in OLED display.
display.print("-Time-"); // Printing of text "Time" in OLED display.
display.setCursor(25,40); // Selection of Starting position for another text of OLED display.
display.setTextSize(2); // Selection of font size of another text in OLED display.
display.setTextColor(SSD1306_WHITE); // Selection of color size of another text in OLED display.
display.print(Real.hour()); // Printing of hour in OLED display.
display.print(":");
display.print(Real.minute()); // Printing of minute in OLED display.
display.print(":");
display.print(Real.second()); // Printing of second in OLED display.
display.print(".");
display.display(); // A command for displaying in OLED display.
} // Loop function closing.