Does anyone have a simple stopwatch program

I found this one but I wanted it to have milliseconds

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");
}

I wanted it to have milliseconds

At 9600 baud, it takes over one millisecond to transmit just one character.
Be careful :wink:

why do you say be careful? Also what about the serial print not showing the real time millis and just displaying it when paused...would that help any?