Super basic Arduino timer

I didn’t realize it would be this easy to build a timer within Arduino. This is not the LED blink code! It’s pretty much based of skyl4rk’s post in this thread. I have a clock running within Arduino and I can configure when to turn the LED on by hour, minutes and even seconds. Eventually we need to somehow connect the Arduino with the user interface to have it control the timer.

As far as the prototype goes, it works for now but it needs to be more robust since the clock is very rudimentary.

Updated July 28, 2008 with the code to share:

int ledPin = 8;
int clock = 998;
int hour = 10;
int min = 27;
int sec = 0;
void setup() {
  Serial.begin(9600);
  pinMode(ledPin, OUTPUT);
}
void loop() {
  delay(clock);

  sec = sec + 1;
  // basic conditionals
  if (sec <= 20) {
    digitalWrite(ledPin, HIGH);
  }
  if (sec > 20) {
    digitalWrite(ledPin, LOW);
  }

  /* if (min > 20 && min < 40) {
    digitalWrite(ledPin, HIGH);
  } else {
     digitalWrite(ledPin, LOW);
  } */

  // time keeping stuff
  if (sec > 59) {
    sec = 0;
    min = min + 1;
  }
  if (min > 59) {
    min = 0;
    hour = hour + 1;
  }
  if (hour > 23) {
    hour = 0;
  }
  Serial.print(hour);
  Serial.print(":");
  Serial.print(min);
  Serial.print(":");
  Serial.print(sec);
  Serial.print("n");
}