Hi, On Monday 31 January 2011 13:21:26 Anders Taranger wrote: > Hi everyone! I have a problem with the TinyOS printf Library for TOS 2.11. > When I run the TestPrintf app in "tinyos-2.2.2/apps/tutorials/Printf" on my > Iris mote it works, but then when I make a FOR-loop it seems like the > printfflush() command doesn't work, nor does the auto-flush work. The > program just stops printing out text like if the buffer is full. Any > thoughts why ?
Having long-executing code in event handlers (such as a loop that uses printf) is generally a bad idea: you are basically taking over system resources until your loop ends, that may cause all kinds of weird behaviours. Try refactoring your code: group your print actions in a task that calls printf a limited number of times and then posts itself, until it has printed all the desired lines. For a set of guidelines on how to write good code for TinyOS, please refer to the TinyOS Programming book: http://csl.stanford.edu/~pal/pubs/tos- programming-web.pdf Regards. -- Giuseppe Cardone, Ph.D. Student DEIS-LIA - Università degli Studi di Bologna E-mail: [email protected] Web: http://lia.deis.unibo.it/Staff/GiuseppeCardone/ _______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
