How can I display a number (reading sensor 0-1024) using LCDI2C4Bit.h library?
function printIn() - let me print a string, so meaby I should just convert int to string? But I do not know how to do it either.
one more question:
I have 2x16 display.
I want on the first row print “Hello”, on the sesond “World”.
I thought I should do it like this:
How to display a float number… the function is ftoa().
I didn’t see ftoa in stdlib.h when I went looking for this functionality in the avr gcc code distributed with the arduino. Where is it?
Yes, checking out I found that avr-gcc doesn’t support ftoa(). You could use then sprintf() like here:
void loop()
{
...
float floatvalue = 5.12;
char stringvalue[10];
sprintf(stringvalue, "%.2f", floatvalue); // %.2f means to round decimal places to 2 digits. If you don' want to round then use %f
...
}
sprintf(stringvalue, “%.2f”, floatvalue); // %.2f means to round decimal places to 2 digits. If you don’ want to round then use %f
…
}
Have you tried these things you're suggesting? I don't think floating point is supported in sprintf either. Anyway, why use sprint which brings in almost 2k of code when there is a much smaller and easy to use function as per post #4 above.