Hi
I am writing a Matlab code for reading and writing data through serial
port. Now, the reading is working, but writing is not.
In Tinyos part, I followed the Lesson 4, Mote-PC serial communication, by
changing BlinkToRadioAppC.nc to
//components ActiveMessageC;
//components new AMSenderC(AM_BLINKTORADIO);
//components new AMReceiverC(AM_BLINKTORADIO);
components SerialActiveMessageC;
components new SerialAMSenderC(AM_BLINKTORADIO);
components new SerialAMReceiverC(AM_BLINKTORADIO);
App.Packet -> SerialAMSenderC.Packet;
App.AMPacket -> SerialAMSenderC.AMPacket;
App.AMControl -> SerialActiveMessageC;
App.AMSend -> SerialAMSenderC.AMSend;
App.Receive -> SerialAMReceiverC.Receive;
In Matlab part :
s = serial('COM11','BaudRate',57600,'DataBits',8);
fopen(s);
write_data = [0 255 255 0 0 4 0 6 0 1 0 1 ];
% 0 synByte
% 255 Destination Addr
% 255 Destination Addr
% 0 Link Source addr
% 0 Link Source addr
% 4 Message length
% 0 Group ID
% 6 am handler
% 0 TOS node id
% 1 TOS node id
% 0 counter
% 1 counter
fwrite(s,write_data,'uint8');
fclose(s);
This should send data back to serial and in BlinkToRadioC.nc the
Receive.receive should receive payload and setLeds(0x01) which means led 0
on.
But no data is received!
Any suggestion?
Thanks
JL
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help