int sec;
int min;
int hr;
long start_time;
long hr_setup = 3600000;
long min_setup = 60000;
long sec_setup = 1000;
void setup()
{
Serial.begin(9600);
}
void loop()
{
start_time = millis();
hr = start_time / hr_setup;
min = (start_time % hr_setup) / min_setup;
sec = ((start_time % hr_setup) % min_setup) / sec_setup;
Serial.print(hr);
Serial.print(":");
Serial.print(min);
Serial.print(":");
Serial.println(sec);
}
沒有留言:
張貼留言