[Tinyos-help] Help: Blink program flow

Paul Armstrong parm at gmprc.ksu.edu
Fri Jan 9 15:53:46 PST 2004


I have been installing several apps and doing some modification to them but I am still puzzled on the program flow for a simple program such as the Blink.  I know it starts a Timer which causes an event (most likely an interrupt) which toggles the red LED.  Does the processor go into a sleep or low power state waiting for an interrupt?

Looking at the BlinkM example below what code is run (after compiling and installing) 

module BlinkM {
  provides {
    interface StdControl;
  }
  uses {
    interface Timer;
    interface Leds;
  }
}
implementation {

  command result_t StdControl.init() {
    call Leds.init(); 
    return SUCCESS;
  }

  command result_t StdControl.start() {
    // Start a repeating timer that fires every 1000ms
    return call Timer.start(TIMER_REPEAT, 1000);
  }

  command result_t StdControl.stop() {
    return call Timer.stop();
  }

  event result_t Timer.fired()
  {
    call Leds.redToggle();
    return SUCCESS;
  }
}


Paul Armstrong
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://Mail.Millennium.Berkeley.EDU/pipermail/tinyos-help/attachments/20040109/0f5b7488/attachment.htm


More information about the Tinyos-help mailing list