#include <Wire.h>
#include "Clock.h"
#include <LiquidCrystal_I2C.h>
#include <RTClib.h>
Clock myClock;
void setup() {
Serial.begin(9600);
Serial.println(" ");
myClock.init_lcd();
myClock.setTime(1, 2, 3);
myClock.getTime();
}
void loop() {
if (Serial.available() > 0) {
String input = Serial.readStringUntil('\n');
if (input == "auto"){
myClock.autoTime();
}
else{
int h = input.substring(0, 2).toInt();//用.substring擷取字串,再轉成int
int m = input.substring(3, 5).toInt();
int s = input.substring(6, 8).toInt();
myClock.setTime(h, m, s);
}
}
myClock.updateTime();
myClock.displayTime();
myClock.getTime();
delay(1000);
}