#include <LiquidCrystal.h>
#include <Wire.h>
#include <RTClib.h>
// Initialize the LCD (16-pin mode)
LiquidCrystal lcd(PB0, PB1, PB10, PB3, PB4, PB5); // RS, E, D4, D5, D6, D7
void setup() {
Serial.begin(9600); // Start serial communication
lcd.begin(20, 4); // Initialize a 20x4 LCD
lcd.setCursor(0, 0);
lcd.print("Real Time Clock");
delay(2000);
lcd.clear();
}
void loop() {
// Set hypothetical date and time (e.g., October 7, 2023, 14:30:00)
int hypotheticalYear = 2024;
int hypotheticalMonth = 10;
int hypotheticalDay = 8;
int hypotheticalHour = 14;
int hypotheticalMinute = 30;
int hypotheticalSecond = 0;
// Clear LCD screen for new data
lcd.clear();
// Display the hypothetical date on the first line
lcd.setCursor(0, 0);
lcd.print("Date: ");
lcd.print(hypotheticalYear);
lcd.print('/');
lcd.print(hypotheticalMonth);
lcd.print('/');
lcd.print(hypotheticalDay);
// Display the hypothetical time on the second line
lcd.setCursor(0, 1); // Move to the second line
lcd.print("Time: ");
lcd.print(hypotheticalHour);
lcd.print(':');
lcd.print(hypotheticalMinute);
lcd.print(':');
lcd.print(hypotheticalSecond);
// Print to Serial Monitor for debugging
Serial.print("Hypothetical time: ");
Serial.print(hypotheticalYear);
Serial.print('/');
Serial.print(hypotheticalMonth);
Serial.print('/');
Serial.print(hypotheticalDay);
Serial.print(" ");
Serial.print(hypotheticalHour);
Serial.print(':');
Serial.print(hypotheticalMinute);
Serial.print(':');
Serial.println(hypotheticalSecond);
// Delay before the next reading
delay(1000);
}