Stopwatch example has an error.

There are unnecessary braces in the code of Stopwatch example (arduino.cc/en/Tutorial/Stopwatch).

// pad in leading zeros - wouldn't it be nice if
// Arduino language had a flag for this? :slight_smile:
if (fractional == 0){
Serial.print("000"); // add three zero's
else if (fractional < 10) // if fractional < 10 the 0 is ignored giving a wrong time, so add the zeros
Serial.print("00"); // add two zeros
else if (fractional < 100)
Serial.print("0"); // add one zero
}
Serial.println(fractional); // print fractional part of time

Ooh, quite right. Not just unnecessary but incorrect! Unfortunately, ordinary users don't have sufficient privilege to edit that page.

Mikal

I moved it to the playground and fixed it: Arduino Playground - Stopwatch

Thank you mellis, Mikal.

[ch12371][ch12385][ch12425][ch12371][ch12381] - we should be thanking you!

Halley, I didn't expect to see Japanese characters in this Forum.
I am pleasantly surprised your flawless Japanese.