I suspect your issue is because you're mixing nx_uint16_t and uint16_t. The former is packed.
-Srikanth <http://srikanthnv.net> On Wed, Oct 30, 2013 at 12:23 PM, Alaios <[email protected]> wrote: > Hi all, > I will need some help to further understand the tinyos fundamentals. I > have written some code (after finishing the mote to radio tutorial on the > official web site) > Part of this tutorial was to create a structure for the information I > would like to send. > > typedef nx_struct WirelessStruct{ > nx_uint16_t id; > nx_uint16_t LedsBits; > }WirelessPkt_t; > > > What I send s > > WirelessPkt_t* msg = (WirelessPkt_t*)(call > Packet.getPayload(&packet,sizeof(WirelessPkt_t))); > msg->id = 2; > msg->LedsBits = 2; > if (call AMSend.send(AM_BROADCAST_ADDR,& packet, > sizeof(WirelessPkt_t))==SUCCESS ) > { > isBusy==TRUE; > } > > my send is succesful as the receiver part, as the leds turn on on the > receiver mote > WirelessPkt_t* incoming=(WirelessPkt_t*)payload; // cast payload to our > data type > uint16_t data= incoming->id; > uint16_t dataTwo =incoming->LedsBits; > > if (data==2 ){ > printf("I RECEIVED PACKAGE AND I AM: !%d!\n",TOS_NODE_ID); > printf("data is: !%d!\n",data); > } > > if though I change the data==2 to the dataTwo==2 nothing happens on the > receiver part. Can someone try to see what might be the problem here? > > I would like to thank you for your help > > Regards > Alex > > _______________________________________________ > Tinyos-help mailing list > [email protected] > https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help >
_______________________________________________ Tinyos-help mailing list [email protected] https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help
