Well....speaking for T1 only...

IntMsg is defined in tos/lib/Counters/IntMsg.h as:

typedef struct IntMsg {
  uint16_t val;
  uint16_t src;
} IntMsg;

Whereas what you want to get, strength, is just an uint16_t.
So what you are probably doing in your modified code is reading
some random junk out of just past where the Msg.strength field is.
Try this instead:

    call IntOutput.output(m->strength);

I'm not sure about the integer to binary part though...
everything inside the little computer-chips is coded in binary.
The uint16_t is 16 bits of 2's compliment binary code for numbers.
Read up a bit on basic binary representation, or rephrase the
question somehow...Also try googling something like:
    strength localization tinyos
There's about a billion papers and help-list messages about it.

MS


Tarek Mohamed Salah El-Din Mansour wrote:
hi,
i am working on my bachelor project about localization in wireless sensor networks using mica2 motes. I have problems obtaining the strength and measuring it and to adjust it.
All i know is that in the RfmToIntM.nc i change the part :

event TOS_MsgPtr ReceiveIntMsg.receive(TOS_MsgPtr m) {
    IntMsg *message = (IntMsg *)m->data;
    call IntOutput.output(message->val);
to:
event TOS_MsgPtr ReceiveIntMsg.receive(TOS_MsgPtr m) {
    IntMsg *message = (IntMsg *)m->strength;
    call IntOutput.output(message->val);
i receive signals on the leds not regular at all, so i was wondering if i can adjust it by ranges or distance?

Another question is how can i change from integer to binary? i would be more than happy if anyone send me coding or papers on similar topic -> localization.


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

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

Reply via email to