[Tinyos-help] send packet

Roberto Pagliari robertodemedici at gmail.com
Thu Apr 29 12:13:35 PDT 2010


Hi All,
I'm having trouble with sending packets, I just moved from tinyos 1 to
tinyos 2. In the following code a node should blinkwhen a packet is
received. The problem is that no packets are sent. AMSend.send, apparently,
always returns FAIL. Does anybody know if I am missing something?

Thanks



  event void Timer0.fired()
  {
    //dbg("BlinkC", "Timer 0 fired @ %s.\n", sim_time_string());
    my_msg_t* rcm = (my_msg_t*)call Packet.getPayload(&packet,
sizeof(my_msg_t));
    if (rcm == NULL) {
      return;
    }
  //  call Leds.led0Toggle();
    rcm->color = value;
    if (call AMSend.send(AM_BROADCAST_ADDR, &packet, sizeof(my_msg_t)) ==
SUCCESS) {
      dbg("RadioCountToLedsC", "RadioCountToLedsC: packet sent.\n",
counter);
      call Leds.led0Toggle();
      locked = TRUE;
    }
    call Timer0.startOneShot( (call Random.rand32()) % 2048 + 100  );
  }

  event message_t* Receive.receive(message_t* bufPtr, void* payload, uint8_t
len) {
      call Leds.led1Toggle();
      return bufPtr;
  }
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-help/attachments/20100429/30cf36c0/attachment.htm 


More information about the Tinyos-help mailing list