[Tinyos-help] Problem in loop execution
Eric Decker
cire831 at gmail.com
Tue Sep 2 00:38:10 PDT 2008
what are you trying to do with the while loop?
What the code will do is will start up the timers 10 times. But each time
the given timer will be restarted but that is all.
in other words the while loo does nothing.
eric
On Mon, Sep 1, 2008 at 11:55 PM, Dhivya G <dhivyabe at gmail.com> wrote:
>
> Hi,
> My application is to enable the Dio pins of MDA320 board at different
> timer intervals. My code is as follows:
>
> command result_t StdControl.init() {
> call Leds.init();
> call DioControl.init();
> return SUCCESS;
> }
> command result_t StdControl.start() {
> uint16_t i;
> call DioControl.start();
> i=0;
> while(i<=10){
> call Timer0.start(TIMER_ONE_SHOT, 1000);
> call Timer1.start(TIMER_ONE_SHOT, 5000);
> call Timer3.start(TIMER_ONE_SHOT, 10000);
> call Timer4.start(TIMER_ONE_SHOT, 15000);
> i++;
> }
> return SUCCESS;
> }
> command result_t StdControl.stop() {
> call DioControl.stop();
> return SUCCESS;
> }
> event result_t Timer0.fired(){
> call Dio2.high();
> call Leds.greenToggle();
> return SUCCESS;
> }
> event result_t Timer1.fired(){
> call Dio3.high();
> call Leds.yellowToggle();
> return SUCCESS;
> }
> event result_t Timer3.fired(){
> call Dio2.low();
> call Leds.greenToggle();
> return SUCCESS;
> }
> event result_t Timer4.fired(){
> call Dio3.low();
> call Leds.yellowToggle();
> return SUCCESS;
> }
>
> In this program While loop is executing only once. After that its not
> repeating. can anyone help me to solve this problem.
>
> --
> Thanks & regards,
> G.Dhivya
>
> _______________________________________________
> Tinyos-help mailing list
> Tinyos-help at millennium.berkeley.edu
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>
--
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20080902/edc3eecf/attachment-0001.htm
More information about the Tinyos-help
mailing list