void setup() {
// Start the I2C interface
Wire.begin();
Serial.begin(9600);
lcd.init();
lcd.backlight();
Serial.println("Please enter the time: year[2]month[2]date[2]DoW[2]hour[2]minute[2]second[2]");
Serial.println("example: 2014-12-3 Wednesday 14:15:15 enter:14120303141515");
//Str to byte
year = atoi(Str_year); //轉換數據類型
month = atoi(Str_month);
date = atoi(Str_date);
DoW = atoi(Str_DoW);
hour = atoi(Str_hour);
minute = atoi(Str_minute);
second = atoi(Str_second);
Clock.setSecond(second);//Set the second
Clock.setMinute(minute);//Set the minute
Clock.setHour(hour); //Set the hour
Clock.setDoW(DoW); //Set the day of the week
Clock.setDate(date); //Set the date of the month
Clock.setMonth(month); //Set the month of the year
Clock.setYear(year); //Set the year (Last two digits of the year)
}
}
void loop() {
int second,minute,hour,date,month,dow,year,temperature;
settime();