Go Down

Topic: Serial LCD 128x64 shows "wrong" information with Serial.print (Read 940 times) previous topic - next topic

vainqueur

Nov 15, 2012, 06:17 pm Last Edit: Nov 15, 2012, 06:51 pm by vainqueur Reason: 1
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.

MarkT

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

I did notice this:
Code: [Select]
      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: [Select]
      int litro=(int) (litros*porcentaje/100.0) ;
      Serial.print(litro,DEC);
[ I won't respond to messages, use the forum please ]

vainqueur

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.

liudr

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)?

MarkT

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

vainqueur

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 :( )

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

Go Up