[Tinyos-help] Problem in loop execution

Eric Decker cire831 at gmail.com
Tue Sep 2 09:44:37 PDT 2008


On Tue, Sep 2, 2008 at 12:51 AM, Dhivya G <dhivyabe at gmail.com> wrote:

> Thanks for your immediate reply. In my application  I am using 2 dio pins.
> At 1 sec, 1st Dio pin should me made high. After 5 sec, 2nd dio pin should
> be high. then for next 5 sec, first dio pin should be low. Then for next 5
> sec 2nd dio pin should be low. This process should be repeated continuously.
>

Can you tell me what you mean by the continuity of this process and how that
relates to the while loop?

This is pretty basic.  Have you read the TinyOS programming manual?  Have
you read the Timer TEP?


> For continuity of this process i am using while loop. but this process is
> executing only once. What code should I need to correct for my application.
>
> Thanks & Regards,
> G.Dhivya
>

We don't mind helping but do like it much better when the homework has been
done.

That said.  Try using a periodic or restart the one shot from the .fired
event.

eric


> On Tue, Sep 2, 2008 at 1:08 PM, Eric Decker <cire831 at gmail.com> wrote:
>
>> 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
>>
>>
>
>
> --
> G.Dhivya
>



-- 
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/26e6dcc3/attachment.htm 


More information about the Tinyos-help mailing list