Go Down

Topic: Temp measurement and display (Read 980 times) previous topic - next topic

dtokez

Thanks  8) I thought you had to tell the characters exactly where to be placed. so that's much better now.

I edited the post while you where replying DOH  :smiley-red:

out if interest, what was I doing wrong with the if/else statements?

dtokez


liudr

This question pops up on a regular basis. Simple solutions I always provide (assume temperature is integer):

Code: [Select]

lcd.setCursor(what,ever);
if (temp<10) lcd.write('0');
lcd.print(temp);


Don't use lcd.clear. It makes your screen flash and dim.

If you need to assure 100 degree, just add "if (temp<100) lcd.write('0');" before the other if.

robtillaart


Or if you prefer spaces iso leading zero's
(based upon code above)
Code: [Select]

lcd.setCursor(right, position);
if (temp<10) lcd.write(' ');  // space
lcd.print(temp);
Rob Tillaart

Nederlandse sectie - http://arduino.cc/forum/index.php/board,77.0.html -
(Please do not PM for private consultancy)

liudr


Go Up