#include"time.h"
void setup() {
// put your setup code here, to run once
Serial.begin(9600);
Serial.print("輸入時分秒:");
}
int count = 0;
int next;
int arr[3];
void loop() {
// put your main code here, to run repeatedly:
Time t;
if(count<=2)
{
if(Serial.available()>0)
{
next = Serial.parseInt();
if(next >= 0)
{
arr[count] = next;
count++;
}
}
}
else
{
t.setTime(arr[0], arr[1], arr[2]);
t.printUniversal();
t.printStandard();
delay(6000);
arr[3] = 0;
Serial.println("請再輸入一次");
delay(2000);
}
}