display float in lcd

Mar 8, 2007 at 2:44pm

display float in lcd

#30692
Mar 8, 2007 at 3:39pm

#98593
Mar 8, 2007 at 4:03pm

On 08.03.2007, at 16:39, Emmanuel Jourdan wrote:

> sprintf with the symout argument is your friend.
>
> ej

hmpf … I patch too slow ;)

here’s the same in ugly but it handles numbers higher/lower than 1000.

cheers, g.

max v2;
#N vpatcher 11 87 1004 743;
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P newex 275 74 27 196617 t i i;
#P newex 195 260 49 196617 switch 2;
#P newex 195 142 27 196617 + 1;
#P newex 195 118 36 196617 > 999;
#P newex 222 230 277 196617 sprintf symout There are %ld users and the
number is %ld.;
#P newex 318 145 46 196617 / 1000.;
#P newex 461 161 27 196617 t b i;
#P number 461 130 97 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 255 52 97 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 397 205 282 196617 sprintf symout There are %.3f users and the
number is %ld.;
#P newex 214 313 27 196617 t l b;
#P newex 214 293 73 196617 prepend write;
#P message 231 341 103 196617 clear , moveto 10 60;
#P user lcd 54 375 380 106 1 1 0 0 0;
#P fasten 1 0 0 0 236 364 59 364;
#P fasten 3 0 0 0 219 364 59 364;
#P fasten 13 1 10 0 297 103 200 103;
#P connect 10 0 11 0;
#P connect 11 0 12 0;
#P connect 9 0 12 1;
#P fasten 12 0 2 0 200 287 219 287;
#P connect 2 0 3 0;
#P connect 13 0 9 0;
#P connect 7 0 9 0;
#P connect 3 1 1 0;
#P connect 4 0 12 2;
#P connect 5 0 13 0;
#P connect 13 0 8 0;
#P connect 7 0 4 0;
#P connect 8 0 4 0;
#P connect 6 0 7 0;
#P connect 7 1 9 1;
#P connect 7 1 4 1;
#P pop;

#98594
Mar 8, 2007 at 6:31pm

Use the nbsp trick for sprintf comes up with:
#P window setfont “Sans Serif” 9.;
#P window linecount 1;
#P comment 80 148 100 196617 Number;
#P button 15 77 15 0;
#P newex 15 168 27 196617 int;
#P number 32 121 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P number 43 147 35 9 0 0 0 3 0 0 0 221 221 221 222 222 222 0 0 0;
#P newex 15 195 240 196617 sprintf There are %i users and the number is %i .;
#P message 254 31 212 196617 There are 10. users and the number is 1.;
#P message 295 64 222 196617 “There are 10.000 users and the number is 1.”;
#P newex 305 136 51 196617 tosymbol;
#P message 306 115 212 196617 There are 10. users and the number is 1.;
#P newex 256 180 27 196617 t l b;
#P newex 256 160 73 196617 prepend write;
#P message 273 208 103 196617 clear , moveto 10 60;
#P user lcd 96 242 380 106 1 1 0 0 0;
#P comment 70 121 100 196617 Users;
#P connect 13 0 12 0;
#P connect 12 0 9 0;
#P connect 10 0 9 1;
#P connect 9 0 3 0;
#P connect 11 0 12 1;
#P fasten 2 0 1 0 278 231 101 231;
#P connect 3 0 4 0;
#P connect 4 1 2 0;
#P connect 5 0 6 0;
#P connect 7 0 3 0;
#P connect 8 0 3 0;
#P connect 6 0 3 0;
#P fasten 4 0 1 0 261 231 101 231;
#P window clipboard copycount 15;


Chris Muir | “There are many futures and only one status quo.
cbm@well.com | This is why conservatives mostly agree,
http://www.xfade.com | and radicals always argue.” – Brian Eno

#98595
Mar 9, 2007 at 8:59am

#98596
Mar 9, 2007 at 11:29am

#98597
Mar 9, 2007 at 1:26pm

#98598
Mar 13, 2007 at 9:50pm

Falk Grieffenhagen schrieb:
> It would be ok to display them with a comma like 3,14 instead of 3.14.
> It would even be ok not to be able to display floats since there are
> most likely none. But there are some sentences which close with an int
> and a full stop and which display 10000 like 10.000 like in the example
> sentence. If they are displayed correctly I can cope with the rest.

You could exchange all blanks with the non white space ” ” which is
ascii 202 it looks like a blank, if you add always the same character at
the end, you should have a perfect visual representation…

Stefan


Stefan Tiedje————x——-
–_____———–|————–
–(_|_ —-|—–|—–()——-
– _|_)—-|—–()————–
———-()——–www.ccmix.com

#98599
Mar 16, 2007 at 8:01pm

#98600
Mar 19, 2007 at 4:47pm

#98601
Mar 21, 2007 at 4:06pm

#98602
Mar 22, 2007 at 10:24am

#98603
Mar 22, 2007 at 3:38pm

#98604
Mar 24, 2007 at 6:26pm

#98605
Mar 26, 2007 at 9:20am

#98606

You must be logged in to reply to this topic.