// CountDownTest Joe Pardue 8/15/09
int seconds = 59;
int minutes = 59; // Inititialise actual values for h,m,s
void setup () {
// begin the serial communication
Serial.begin(9600);
}
void loop () {
seconds = seconds - 1; // decrement the seconds
tick = 0; // reset the tick flag
if (seconds < 0){ // If a minute has passed
seconds = 59 ; // Send seconds up to 59
minutes = minutes - 1; // decrement the minutes
}
Serial.print(minutes,DEC);
Serial.print(":");
Serial.println(seconds,DEC);
delay(1000); // wait a second
}
Btw, your code won't implement an accurate clock. All the code, not only delay(), will take some time to execute, especially Serial.println calls. So the constant delay of 1000 ms won't work. You can use millis() to calculate more accurate delay-time.