will be read-only starting December 31st, 2018. For more info please look at this Forum Post

Printing Numbers

The itoa() stdlib C library function can be used to convert a number into a string, in a variety of bases (e.g. decimal, binary). The buffer must be large enough to hold the largest number, plus sign and terminating null: e.g. 32 bit base-10: "-2147483648\0" = 12 characters.

The stdlib itoa() library routine adds around 600 bytes, the roll-your-own K&R implementation, which includes string.h, adds around 670 bytes. Using snprintf() from stdio.h adds just over 2200 bytes.


char buf[12]; // "-2147483648\0"
lcd.printIn(itoa(random(1024)-512, buf, 10));