hi ive searched around and found somestuff on this, what im trying to do is create a simple "count" displayer. i have a lcd and i am using this library http://www.arduino.cc/playground/Code/LCD4BitLibrary. the example code works, i get all the fruit to display just like they should. Now i want to incorperate this lcd into my arduino alarm clock and i need to no how to convert a regular integer into a character. i read something about using "itoa()" but dont understand it, could someone explain.
void lcdDisplayInt(long number){ // display hex number on LCD followed by a space
long j = 0xf0000000;
int i = 28;
byte n;
for( int k = 0; k<8; k++){
n = ((number & j) >> i) & 0xf;
if( n>9 ) n = n + 0x37; else n = n | 0x30;
lcd.write(n);
i-=4;
j = j >> 4;
}
lcd.print(" ");
}
On the Arduino playground it is discibed
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.