Thanks Ben,

I tried something very simple:

1. I get the byte stream from usb sent from the TMote like:
  7e 42 xx xx xx xx 7e

2. I remove the 7e from the stream and send it back as it is (42 xx xx
xx xx). But I still don't get it. C/C++ should be able to handle this
no?

Is there any doc on how the serial communication should be
established. I have gone through the java code for sending but still
it would help with a doc.

Indy


On 4/11/07, Ben Buckner <[EMAIL PROTECTED]> wrote:
> Hi,
>
> I have trouble sending msg from laptop (using c++) code to tmote.  All
the
> code is at the bottom. I have no problem reading the data from the
serial
> but sending it back dooesn't seam to work. Anyone knows why? Thanks.
>
> Indy
[...]
>     memcpy(output_buffer, &msgOUT, sizeof(msgOUT));

Out of the dozens of things that could be wrong, it might be worth
pointing
out that C does not guarantee that structures can be serialized by copying
bytewise out of memory like that. It can work, but you never know. The
most
usual reason why that would fail is if the compiler tries to align the
members of the structure and inserts padding (which it almost always does
with odd-sized byte fields). At any rate, it would be a good idea to make
sure that the code really generates the byte stream that you think it's
generating.

Ben B.



_______________________________________________
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