I had similar problem. I cannot make BlinkToRadio work for my mica2dot mote.

Hey,

The code looks fine.

I'd suggest you go step wise by first making one of the motes just a sender
and the other just a receiver.

See if that works.

cheers,
Nishad

On Thu, May 9, 2013 at 2:34 AM, Sandeep Bezawada <[email protected]>wrote:

>
> Hi all,
>
> I am new to sensor networks. I am working on a project that does load
> balancing. But in my project Receive event is not working. So, I tried to
> do simple send and receive but no luck.
>
> Please see my code below
>
> implementation {
>   bool busy = FALSE;
>
>   message_t pkt;
>   uint16_t counter = 1;
>   bool fwd =  FALSE;
>
>
> /*--------------------------------------------------------------*/
>   event void Boot.booted() {
>
>       call AMControl.start();
>    }
>   /*--------------------*/
> event void AMControl.startDone(error_t err) {
>     if (err == SUCCESS) {
>       call Timer0.startPeriodic(300);
>     }
>     else {
>       call AMControl.start();
>     }
>   }
>
>   event void AMControl.stopDone(error_t err) {
>   }
>
>   /*-----*/
> event void Timer0.fired() {
>
>   if (!busy) {
>     BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)(call
> Packet.getPayload(&pkt, sizeof (BlinkToRadioMsg)));
>     btrpkt->nodeid = TOS_NODE_ID;
>     btrpkt->counter = counter;
>     if (call AMSend.send(AM_BROADCAST_ADDR, &pkt, sizeof(BlinkToRadioMsg))
> == SUCCESS) {
>      * printf("AM layer sends\n");*
>       busy = TRUE;
>     }
>   }
> }
>   /*------------*/
> event void AMSend.sendDone(message_t* msg, error_t error) {
>     if (&pkt == msg) {
>      * printf("sent successfully\n");*
>       busy = FALSE;
>     }
>   }
>   /*-------------*/
> event message_t* Receive.receive(message_t* msg, void* payload, uint8_t
> len) {
>   if (len == sizeof(BlinkToRadioMsg)) {
>     BlinkToRadioMsg* btrpkt = (BlinkToRadioMsg*)payload;
>    * printf("receive\n");*
>     call Leds.set(btrpkt->counter);
>   }
>   return msg;
> }
> }
>
> I have installed this on 3 mica2 motes and tested
>
> My output is
> AM layer sends
> sent succesfully
> ..
> ..
>
>
> But receive is not printing
> Please help
>
> --
> sandeep
>
> _______________________________________________
> Tinyos-help mailing list
> [email protected]
> https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
>



--
Sincerely,

Nishad Kamdar
Graduate student
BITS PILANI , K K Birla Goa campu*s*
Cell: +919503218809
-------------- next part --------------
An HTML attachment was scrubbed...
URL: 
https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20130509/b0baba5a/attachment.htm

------------------------------

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

End of Tinyos-help Digest, Vol 121, Issue 8
*******************************************

Institute for Infocomm Research disclaimer:  "This email is confidential and 
may be privileged. If you are not the intended recipient, please delete it and 
notify us immediately. Please do not copy or use it for any purpose, or 
disclose its contents to any other person. Thank you."

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

Reply via email to