Go Down

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


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


PD. The errors just appear when i print the variable level, porcentage and litros.


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

I did notice this:
Code: [Select]
      int litro=((litros/100)*(porcentaje));

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) ;
[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


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

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.


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)?
Serial LCD keypad panel,phi_prompt user interface library,SDI-12 USB Adapter


[ I will NOT respond to personal messages, I WILL delete them, use the forum please ]


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


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

Please enter a valid email to subscribe

Confirm your email address

We need to confirm your email address.
To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

via Egeo 16
Torino, 10131