Serial decimal percision.

Im trying to get my serial data to be outputted with 2 decimals so 00, 01, 02, 03, 04, ect...

Is there something I can add to this code:

void setup() {
  Serial.begin(9600);
}
void loop() {

  for(int i=0; i<=100;i++) {
    for(int j=16; j<=199;j++) {

      Serial.print(i, DEC);
      Serial.println(j, DEC);
      delay(50);
    }
  }
}

Without having code like this :

void setup() {
  Serial.begin(9600);
}
void loop() {

  for(int i=0; i<=100;i++) {
    for(int j=0; j<=100;j++) {
      if(i<10){Serial.print("0");}
      Serial.print(i, DEC);
      if(j<10){Serial.print("0");}
      Serial.println(j, DEC);
      delay(50);
    }
  }
}

Sure, you can use sprintf and the %0u format specifier to add leading 0's, then print the string:

char buf[8];

sprintf(buf, "%02u", i);
Serial.print(buf);

--
The Gadget Shield: accelerometer, RGB LED, IR transmit/receive, light sensor, potentiometers, pushbuttons

Thank you that worked perfect.

If you want all values to have the same number of digits, you need to change the format specifier, or when i and j go over 99, the number will have 3 digits.