Limiting number of decimal places
Posted: Wed May 22, 2013 12:32 am
I have a V2.0 lcd shield sitting on an Eleven, V1.0.
There is one line of lcd.print() code that refuses to display a limited number of decimal places.
example;
float Irms = emon1.Irms;
lcd.print(Irms,1);
This should constrain the number of places to one - I get three to four - random!
All other lcd.print() statements for other variables, eg lcd.print(X,1) lcd.print(Y,2) etc play the game and the lcd displays one or two places.
There is nothing anywhere that I can see that would cause one line to be corrupted.
Has anyone seen this random behaviour in their code?
There is one line of lcd.print() code that refuses to display a limited number of decimal places.
example;
float Irms = emon1.Irms;
lcd.print(Irms,1);
This should constrain the number of places to one - I get three to four - random!
All other lcd.print() statements for other variables, eg lcd.print(X,1) lcd.print(Y,2) etc play the game and the lcd displays one or two places.
There is nothing anywhere that I can see that would cause one line to be corrupted.
Has anyone seen this random behaviour in their code?