EmbeddedWirelessSensors

From School2007

Jump to: navigation, search

Media:labs.pdf

MyBlinkC.nc

module MyBlinkC {
  uses interface Timer2<TMilli> as Timer;
  uses interface Leds;
  uses interface Boot;
} // End module MyBlinkC

implementation {

  event void Timer.fired() {
    call Leds.redToggle();
  }

  event void Boot.booted() {
    call Leds.init();
    call Leds.redOff();
    call Leds.greenOff();
    call Leds.yellowOff();
    call Timer.startPeriodic(1000); // 1 sec repeat timer
  }

} // End implementation


MyBlinkApp.nc

configuration MyBlinkApp {

} // End configuration MyBlinkApp

implementation {

  components Main, MyBlinkC, LedsC;
  components new TimerMilliC() as Timer0;
  MyBlinkC.Boot -> Main.Boot;
  MyBlinkC.Leds -> LedsC;
  MyBlinkC.Timer -> Timer0;

} // End implementation


Makefile

COMPONENT ?= MyBlinkApp

include $(MAKERULES)
Personal tools