Hi, Roman Haefeli wrote: > On Wed, 2013-07-03 at 16:36 +0200, Charles Goyard wrote: > > Hi list, > > > > apologizes, this looks like a FAQ, but I can't find anything in the > > archives (wrong keywords ?) for this. > > > > I just want to turn the bytes from comport output into a list. > > > > From a serial monitor, my program outputs: > > "1.23 456 789\n" > > > > I get it correctly into pd and it seems to work. But it looks ugly and > > I feel it could be better done. > > I don't see how it could be improved much. Why is it ugly? > > The only smallish improvement I see is the way you convert a stream into > lists. The recursive [list prepend] approach gets more and more > inefficient the longer the list gets. You could use a message box > instead and add your bytes with [add2 $1(. And on termination (sel 10) > send a 'bang, set' to output the finished list and empty the message > box.
It works better with your solution (the terminator is never in the wrong place) and is easier to read. Attached. Thanks a lot. -- Charles
#N canvas 2 47 837 751 10; #X obj 358 369 outlet; #X obj 358 160 inlet; #X obj 358 206 select 10; #X obj 358 331 moocow/bytes2any 128 10; #X msg 409 269 add2 \$1; #X msg 358 298; #X msg 358 239 bang \, set; #X connect 1 0 2 0; #X connect 2 0 6 0; #X connect 2 1 4 0; #X connect 3 0 0 0; #X connect 4 0 5 0; #X connect 5 0 3 0; #X connect 6 0 5 0;
_______________________________________________ [email protected] mailing list UNSUBSCRIBE and account-management -> http://lists.puredata.info/listinfo/pd-list
