Pages: [1]   Go Down
Author Topic: Serial LCD 128x64 shows "wrong" information with Serial.print  (Read 772 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!
Im new in this forum. I have a problem with some variables that i want to print in the serial lcd 128x64. In my code, i use some variables int andf float to make some operations, but when i want to show them in the lcd appear more characters that dont have to appear! (Using Serial.print and Serial.printl) and i dont know why they are showed.
I hope somebody can help me with it, i have tryed to change all the variables to int type and all float, but is the same problem.

I left the link where my code is.

https://dl.dropbox.com/u/57429772/Pantalla/Pantalla.pde

PD. The errors just appear when i print the variable level, porcentage and litros.
« Last Edit: November 15, 2012, 12:51:08 pm by vainqueur » Logged

0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Not sure what you are seeing - show us a photo perhaps?

I did notice this:
Code:
      int litro=((litros/100)*(porcentaje));
      Serial.print(litro,DEC);
Which will fail as litros is an int - integer division is not what you want here, try:
Code:
      int litro=(int) (litros*porcentaje/100.0) ;
      Serial.print(litro,DEC);
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks, I've modified the code you give me, but the error still showing, i add a link to show the photos that i took
https://dl.dropbox.com/u/57429772/2012-11-15-1452.jpg
https://dl.dropbox.com/u/57429772/2012-11-15-1447.jpg

the first number is the porcentage, but when i move the potenciometer to change it, the last numbers doesnt erase or they change the position, thats why there are 2 points.
the 2nd num is just an analog read.
3rd is just a counter
4th is "litros" that shows other numbers or symbols.

And thanks a lot for your help.
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 72
Posts: 7171
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there a spec sheet of the display? I have a theory but need some reading.

BTW, does the "wrong" info always appear the same glyph (shape)?
Logged


0
Offline Offline
Shannon Member
****
Karma: 200
Posts: 11694
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You aren't erasing the line before overprinting?
Logged

[ I won't respond to messages, use the forum please ]

Offline Offline
Newbie
*
Karma: 0
Posts: 10
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi!, this is the datasheet of lcd i use:

https://dl.dropbox.com/u/57429772/Corrected-SFE-0016-DataSheet-08884-SerialGraphicLCD-v2.pdf

and yes, the "wrong" info appear always whith the same variables, (the "wrong" info change, stm are numbers or symbols, points or whatever), what i've though is that perhaps when i make operations with the variables im not doing it well, and that operations generate that "wrong" code/info, because stm everything is printed well, and others appear that wrong info. (and i dont know what to do smiley-sad )

(and i just rewrite over the characters i print, i've tried eraseing the code once is printed, but it star to blink) smiley-confuse
Logged

Pages: [1]   Go Up
Jump to: