Arduino convert int to char

Why a blog post for this super simple thing?

Because I struggled to find an answer online myself even though the solution is pretty easy. Hopefully this post can conquer the Google results and help others.

How?!

int exampleValue = 13;

// length of char needs to be fitting for value
char newChar[2];

String temp_str = String(exampleValue);
temp_str.toCharArray(newChar,2); 

If you have bigger Int values, you need to increase the size of the char array like this.

int exampleValue = 12345;

char newChar[5];

String temp_str = String(exampleValue);
temp_str.toCharArray(newChar,5); 

Credit

Credit for that tip goes to @yhtomitsy over at instructables