Hi Philip,

thanks for the hint, it worked so far, my timer starts now periodically.
But, unfortunately, there is another problem occured.

Let me explain briefly the scenario: My tmote sky should send not in a fixed
timer interval, it should send in a random interval. Thats everything I want.

Therefore, I wrote this in die AMControl.startDone()

call report_timer.startPeriodic( call Random.rand16() % TIMER_PERIOD_REPORT);

My timer is the report_timer and TIMER_PERIOD_REPORT is defined as an uint_16 in
my header file. This should initialize the timer with a random value (this works
so far).

Now, when the report_timer fires, I want to compute a new random value and set
the report_timer period to the new value.
Therefore I wrote in the report_timer.fired()

call report_timer.startPeriodic( call Random.rand16() % TIMER_PERIOD_REPORT );

I thjink this should be right, or?
The problem is, that the mote stops to send reports after a while (sometimes
after 10 packets, sometimes after 300 packets) and I don't have any idea why?!

Do you have an idea?

Best,
Martin



Quoting Philip Levis <[email protected]>:

>
> On Nov 3, 2009, at 4:33 AM, [email protected] wrote:
>
> > Hi,
> >
> > I'm programming at the moment a little application, where it is
> > desired, to use
> > random numbers.
> >
> > I looked at thedocumentation, there is a RandomC, wich is like a
> > wrapper for
> > RandomMlgcC (and the other not so good one...).
> >
> > Now, I added this to my configuration:
> >
> > components RandomC;
> >
> > and
> >
> > App.Random -> RandomC;
> >
> > In my module file, I added this:
> >
> > interface Random;
> >
> > What should I do now, to initialize the generator? I thought, I
> > should do sth.
> > like Random.init() in the Boot.booted() method, but this is not the
> > right way.
> >
> > So, please, any hints how to start (and use) the generator.
> >
> > Would be very kind!
>
> The generator is automatically initialized. Just use the Random
> interface to get random numbers. You can also re-initialize the RNG if
> you want.
>
> Phil
>




----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to