Hi,

the receive event must return a pointer to a message_t where TinyOS will write
the next incoming message. For example, if you want to reuse the same message,
you can just return msg:

event message_t* Receive.receive(message_t* msg, void* payload, uint8_t len)
{
    call Leds.led1Toggle();
    return msg;
}

For more details, please refer to TinyOS tutorials and to
http://csl.stanford.edu/~pal/pubs/tos-programming-web.pdf

Regards,
  Giuseppe

On Monday 20 June 2011 14:54:05 [email protected] wrote:
> Hello,
>
> I have been using the MicaZ motes for a few weeks without any trouble but
> all of the sudden I can't get the receive message event to work properly.
>
> My code for the event is simply:
>
>       event message_t* Receive.receive(message_t* msg, void* payload,
uint8_t
> len)
>        {
>               call Leds.led1Toggle();
>       }
>
> I set it up with another mote sending a simple message every second.
>
> Led 1 turns on when I start up the other mote, but it will not toggle. This
> leads me to believe the event is only being called once and not every time
> it gets a message. I toggle another LED in a timer and it continues to
> toggle the whole time the mote is on (so its not like its freezing or
> anything).
>
> Is there any reason that the receive event would only be called once?
>
> I had this working fine before and I don't know what I'm doing differently
> now.
>
> Thanks for your help,
> Matthew Jacques

--
Giuseppe Cardone, Ph.D. Student
DEIS-LIA - University of Bologna
E-mail: [email protected]
Web: http://lia.deis.unibo.it/Staff/GiuseppeCardone/

LA RICERCA C’È E SI VEDE:
5 per mille all'Università di Bologna - C.F.: 80007010376
http://www.unibo.it/Vademecum5permille.htm

Questa informativa è inserita in automatico dal sistema al fine esclusivo della 
realizzazione dei fini istituzionali dell’ente.

_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to