Hi gurus,
 
I wrote my first program with nesC. It is supposed to turn on or off leds on one mote every second. It includes two modules, Blink and Control, under my home directory. Blink provides interface Manipulate to turn on or off all leds. And Control is a main to use Timer and Manipulate to turn on or off all leds every second.
However, the compiler keeps returning a message that it couldn't find interface Manipulate. But I did include MyBlink into both Ctrl module and configuration. I have been working on for a few days. But still can't figure out where the problem is. Can anybody help me with it?
Thanks in advance!
 
Error Message
------------------
ControlM.nc:7: interface Manipulate not found
C:/PROGRA~1/tinyos/cygwin/opt/tinyos-1.x/tos/interfaces/Timer.nc:42: expected interface `Manipulate', but got interface 'Timer'
ControlM.nc: In function `StdControl.init':
ControlM.nc:17: `Blink' undeclared (first use in this function)
ControlM.nc:17: (Each undeclared identifier is reported only once
ControlM.nc:17: for each function it appears in.)
ControlM.nc: In function `Timer.fired':
ControlM.nc:35: interface has no command or event named `lightOff'
ControlM.nc:37: interface has no command or event named `lightOn'
BlinkM.nc: At top level:
BlinkM.nc:29: `lightOn' is not in interface `Manipulate'
BlinkM.nc: In function `Manipulate.lightOn':
BlinkM.nc:30: commands must be called with call
BlinkM.nc:31: commands must be called with call
BlinkM.nc:32: commands must be called with call
BlinkM.nc: At top level:
BlinkM.nc:36: `lightOff' is not in interface `Manipulate'
BlinkM.nc: In function `Manipulate.lightOff':
BlinkM.nc:37: commands must be called with call
BlinkM.nc:38: commands must be called with call
BlinkM.nc:39: commands must be called with call
Control.nc: At top level:
Control.nc:12: cannot find `Control'
Control.nc:13: cannot find `Control'
make: *** [build/pc/main.exe] Error 1
 
Below is my source. It is pretty dummy. I am using tos under Cygwin. 
------------------
configuration Control {
}
 
implementation
{
  components Main, ControlM, Blink, TimerC;
 
  Main.StdControl -> Blink.StdControl;
  Main.StdControl -> TimerC.StdControl;
  Main.StdControl -> ControlM.StdControl;
 
  Control.Timer -> TimerC.Timer[unique("Timer")];
  Control.Manipulate -> Blink.Manipulate;
}
------------------
module ControlM {
  provides {
    interface StdControl;
  }
  uses {
    interface Timer;
    interface Manipulate;
  }
}
 
implementation
{
  int state;
 
  command result_t StdControl.init()
  {
     return call Blink.init();
  }
 
  command result_t StdControl.start()
  {
     state = 0;
     return call Timer.start(TIMER_REPEAT, 1000);
  }
 
  command result_t StdControl.stop()
  {
     return call Timer.stop();
  }
 
  event result_t Timer.fired()
  {
     state = (state++) % 2; 
     if(state == 0)
       call Manipulate.lightOff();
     else
       call Manipulate.lightOn();
     return SUCCESS;
  }
}
--------------------
configuration Blink {
  provides {
    interface StdControl;
    interface Manipulate;
  }
}
 
implementation
{
  components BlinkM, LedsC;
 
  BlinkM.Leds -> LedsC;
}
-------------------------
module BlinkM {
   provides {
     interface StdControl;
     interface Manipulate;
   }
   uses {
     interface Leds;
   }
}
 
implementation
{
  command result_t StdControl.init()
  {
    return call Leds.init();
  }
 
  command result_t StdControl.start()
  {
    return SUCCESS;
  }
 
  command result_t StdControl.stop()
  {
    return SUCCESS;
  }
 
  command result_t Manipulate.lightOn()
  {
    Leds.redOn();
    Leds.yellowOn();
    Leds.greenOn();
  }
 
  command result_t Manipulate.lightOff()
  {
    Leds.redOff();
    Leds.yellowOff();
    Leds.greenOff();
  }
}
 
_______________________________________________
Tinyos-users mailing list
[EMAIL PROTECTED]
http://mail.Millennium.Berkeley.EDU/mailman/listinfo/tinyos-users

Reply via email to