On Wednesday 13 September 2006 08:40 am, Conor Todd wrote:
> On 9/13/06, campbell gao <[EMAIL PROTECTED]> wrote:
> > //timer
> > MSPSensingM.LedsTimer -> TimerC.Timer[unique("MSPSensing")];
> > MSPSensingM.SyncTimer -> TimerC.Timer[unique("MSPSensing")];
> > MSPSensingM.SendTimer -> TimerC.Timer[unique("MSPSensing")];
>
> Perhaps you need to pass different strings to unique() in order to get
> different values out of it? What I am implying is that all three of the
> timers you wire below may resolve to the same timer because you give them
> all the same name.
unique() is very cool. From Philip Levis' "TinyOS Programming" v1.0, section
6.2:
"The unique function takes a string key as an argument, and
promises that every instance of the function with the same key
will return a unique value. Two calls to unique with different keys
can return the same value.
So, instead of writing:
MSPSensingM.LedsTimer -> TimerC.Timer[0];
MSPSensingM.SyncTimer -> TimerC.Timer[1];
MSPSensingM.SendTimer -> TimerC.Timer[2];
you do:
MSPSensingM.LedsTimer -> TimerC.Timer[unique("MSPSensing")];
MSPSensingM.SyncTimer -> TimerC.Timer[unique("MSPSensing")];
MSPSensingM.SendTimer -> TimerC.Timer[unique("MSPSensing")];
If you haven't read it, I highly recommend Philip Levis' manual. I believe
the 'official' URL for it is:
http://csl.stanford.edu/~pal/pubs/tinyos-programming.pdf
Steve
_______________________________________________
Tinyos-help mailing list
[email protected]
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help