Thank you!!!

Well, I've tried to add [uint8_t id] as you suggest me but now now I get another error:

=====================================================
$ make mica2
mkdir -p build/mica2
    compiling Semaforo1 to a mica2 binary
ncc -o build/mica2/main.exe -Os -finline-limit=100000 -Wall -Wshadow - DDEF_TOS_A M_GROUP=0x7d -Wnesc-all -target=mica2 -fnesc-cfile=build/mica2/app.c - board=mica sb -DIDENT_PROGRAM_NAME="Semaforo1" - DIDENT_PROGRAM_NAME_BYTES="83,101,109,97,10 2,111,114,111,49,0" -DIDENT_USER_ID="Administrator" - DIDENT_USER_ID_BYTES="65,10 0,109,105,110,105,115,116,114,97,116,111,114,0" - DIDENT_HOSTNAME="dewsoli2" -DID ENT_HOSTNAME_BYTES="100,101,119,115,111,108,105,50,0" - DIDENT_USER_HASH=0x268063
f6L -DIDENT_UNIX_TIME=0x47a032d0L Semaforo1.nc -lm
Semaforo1M.nc:37: syntax error before `{'
Semaforo1M.nc: `Timer.fired' not implemented
Semaforo1.nc:9: no match
make: *** [exe0] Error 1
========================================================

Where:

Semaforo1M.nc line 37 is  -----> event result_t Timer.fired[1]() {

and Semaforo1.nc is ------> SemaforoM.Timer -> TimerC.Timer[unique ("Timer")];

I'm now trying to follow "empirical" solutions, I'm trying to change some parts of the code but no solutions seems to work.
What else can I try?

Thank you!!

Ubaldo
--



Il giorno 29/gen/08, alle ore 19:48, Kevin Klues ha scritto:

I didn't look carefully, but the first problem that jumped out to me
was taht you need to have

uses interface Timer[uint8_t id];

not just
uses interface Timer;

in your module definition.

Kevin

On Jan 29, 2008 7:29 AM, Ubaldo Tiberi <[EMAIL PROTECTED]> wrote:
Hello everybody.

I've just start studying theTinyOS and I have some problems about
parametrized intefaces.
The code I wrote is below (this app is something that should simulate
a traffic light, I know that I could did it in another way, but I did
it so just as exercise)


=====================================================

configuration Semaforo {
}
implementation {
   components Main, SemaforoM, TimerC, LedsC;

   Main.StdControl -> TimerC.StdControl;
   Main.StdControl -> SemaforoM.StdControl;
   SemaforoM.Timer -> TimerC.Timer[unique("Timer")];
   SemaforoM.Leds -> LedsC;
}


=====================================================

module SemaforoM {
   provides {
     interface StdControl;
   }
   uses {
     interface Timer;
     interface Leds;
   }
}


implementation {

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

   command result_t StdControl.start() {
       return call Timer.start[1](TIMER_ONE_SHOT, 1000);
         }



   command result_t StdControl.stop() {
     return call Timer.stop[1]();

   }

event result_t Timer.fired[1]() {
     switch (call Leds.get()) {
       case 1:
         call Leds.redOff();
         call Leds.yellowOn();
         call Timer.start[1](TIMER_ONE_SHOT, 1000);
         break;
       case 4:
         call Leds.greenOn();
         call Timer.stop[1]();
         call Timer.start[2](TIMER_ONE_SHOT, 300);
         break;
       default :
         call Leds.redOn();
         call Timer.start[1](TIMER_ONE_SHOT, 1000);
         break;
     }
     return call Timer.start[1](TIMER_ONE_SHOT, 1000);
   }

event result_t Timer.fired[2]() {
       call Leds.greenOff();
       call Leds.yellowOff();
       call Leds.redOn();
       return call Timer.start[1](TIMER_ONE_SHOT, 1000);
   }
}
====================================

When I compile it I  obtain the following errors:

=========================================

[EMAIL PROTECTED] /opt/tinyos-1.x/apps/Semaforo
$ make mica2
mkdir -p build/mica2
     compiling Semaforo to a mica2 binary
ncc -o build/mica2/main.exe -Os -finline-limit=100000 -Wall - Wshadow -
DDEF_TOS_A
M_GROUP=0x7d -Wnesc-all -target=mica2 -fnesc-cfile=build/mica2/ app.c -
board=mica
sb -DIDENT_PROGRAM_NAME="Semaforo" -
DIDENT_PROGRAM_NAME_BYTES="83,101,109,97,102
,111,114,111,0" -DIDENT_USER_ID="Administrator" -
DIDENT_USER_ID_BYTES="65,100,10
9,105,110,105,115,116,114,97,116,111,114,0" -
DIDENT_HOSTNAME="dewsoli2" -DIDENT_
HOSTNAME_BYTES="100,101,119,115,111,108,105,50,0" -
DIDENT_USER_HASH=0x268063f6L
-DIDENT_UNIX_TIME=0x479f328eL Semaforo.nc -lm
SemaforoM.nc: In function `StdControl.start':
SemaforoM.nc:69: subscripted value is neither array nor pointer
SemaforoM.nc: In function `StdControl.stop':
SemaforoM.nc:80: subscripted value is neither array nor pointer
SemaforoM.nc: At top level:
SemaforoM.nc:90: syntax error before `{'
SemaforoM.nc: `Timer.fired' not implemented
make: *** [exe0] Error 1
==========================================

What's happening? Who illustrate me how modificate the code and tell
me why?
And... if I wanna declare the wiring as

----->   SemaforoM.Timer -> TimerC.Timer[uint8_t id];

How should I modify the module SemaforoM.nc??
Thank You!!

Ubaldo Tiberi
--


 --
Email.it, the professional e-mail, gratis per te: http:// www.email.it/f

 Sponsor:
Stai cercando l'email marketing di successo ed economica? Prova con Email.it le tue campagne di Email Marketing a partire da 250 Euro!
*
 Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7149&d=29-1
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/ tinyos-help




--
~Kevin



--
Email.it, the professional e-mail, gratis per te: http://www.email.it/f

Sponsor:
Un prestito fino a 30.000 Euro? Clicca qui: preventivo e assistenza GRATIS. Con 
Prometeo i migliori esperti subito a tua disposizione.. e tutto senza spese 
aggiuntive!
* Clicca qui: http://adv.email.it/cgi-bin/foclick.cgi?mid=7493&d=30-1
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to