Hi
I am using sofwareSerial to send data to an LCD...
my problem is that if I print a value with 3 digits and the next value has only one digit, the last two digits of the previous value are still on the lcd...
to make myself clear...
if I print 168 it prints ok
if the next number is 7 it prints the 7 but the number on the LCD is 768
How can I resolve this issue?Can I set the format of the integer to have 3 digits all the time?
Can I set the format of the integer to have 3 digits all the time?
Depends on how you convert the integer to a string. If you use itoa, then, no. If you use sprintf, then, yes. If you let the LCD library handle the conversion, then you need to look at how it does it.
You could always write 3 spaces, then reset the cursor and write your number.
I wrote this routine that I call each time I want to output to the LCD. I have a 16x2 LCD and I'm sure actual programmers could point out where I use unnecessary commands or ways it could be done better. You can see the 2nd and 3rd statement clear the display line of what was on it before by a brute force writing of blanks.
I call it LCD_Static because I was planning on writing another routine I would call to write to the LCD and it would then scroll that line. I found the Autoscroll() command scrolls both lines of the LCD rather than just one; not what I wanted.