Convert String to int

I use sprintf() to convert data types to formatted strings. If you want a specific number of leading zeros, try this. It insures there are three characters, and if not, it adds the correct number of leading zeros.

int myInt = 12;
char outBuf[16];
sprintf(outBuf,"%03u",myInt);
Serial.println(outBuf);