displaying numbers

Aug 31, 2013 at 11:37am

displaying numbers

often i am using lcd instead of numberboxes to display numbers. what i find annoying is that lcd displays zerois behind the last value, e.g. 82.125000.

do you have an idea what is the best way to cut off these 0´s – avoiding regexp and itoa/atoi?

-110

#263849
Sep 1, 2013 at 5:12am

[regexp] is probably the way to go. Otherwise, you could do some custom JScript, Java, or «gasp!» C.

The long and the short of it is that, until lcd has an attribute allowing you to specify the formatting conventions for float-to-string, you’re going to have to use some object to pre-process the float into the string (symbol) format you want.

#263891
Sep 1, 2013 at 4:31pm

damn, thats what i thought.

so i will not search für zeros, i will just split the numbers at the comma and limit the right part to three characters.

#263929

You must be logged in to reply to this topic.