Hello, with my Mega project, I am using a direct wired LCD that is 16x2.
I noticed that after a while, the display gets confused and displays some bad chars on the edges. I didn't think the program is corrupt as my Serial display looks good.
What I am doing is that when the program outputs to the screen periodically, I rapidly scroll right to reorient the display. Then after each 700 ms, I scroll to the left a char. This way, it acts as a banner. To clear a row, I LCD.print(' ') to overwrite. I wonder if I'm blasting it too quickly. Is there a more featured library?
Eventually I plan to switch to I2C two wire 40x2 column display. I don't want to overwhelm it.
I see a function that appears to write 40 blanks to a 16 char wide display. How does that work?
You have an awful lot of extra code plus a class. I use that display and don't need any of that. Mine is the I2C, maybe that makes a difference?
I noticed that after a while, the display gets confused and displays some bad chars on the edges.
Can you clarify what this means.
i.e. it could mean that things are still functioning properly but you see some unexpected characters on the left or right side of the display, or maybe you mean that things are worse than that.
But more importantly we can't really offer suggestions since we can't see the code you are running that you are having issues with since you only provided a limited portion of your code.
i.e. We should be able to see all the code to fully understand what is being done and if desired, use the code to replicate the problem.
I can think of a several things that can cause issues but without knowing more about your code I can't narrow down to specifics.
There are 40 characters in the first row and 40 in the second row. If you were to write a 41st character in either row, the next character would appear as the first character in the other row.
i doubt that. Your for loop to print blanks will not put out the data faster than a single line LCD.print(F(" "));
in the end there are 40 single lcd.writes() to print a blank.
Please post a schematic and good pictures of your installation to see each wire connection including the soldering on your LCD.
Please post a FULL CODE to enable helpers to reproduce the problem.
There are a series of myLcd.print(...) calls.
I noticed the chars get funky at the beginning or the end of the strings. Only the LCD shows such mess. I noticed this with unshielded slot cars driving by. They are known to kick out RF.
Reading the older forum articles, appears another person had a similar issue 10 years ago. His solution was to use "10ms in front of lcd.print". His last post he was going to try 1ms. So I will do the same.
I now remember, I refactored my code. I used to have big clumsy sprintf(buf,"format",...) so instead I changed it to a series of print().