Hello,
I am trying to connect my MATLAB GUI with SerialForwarder application to
fetch the data from it.
I wrote a simple client application in MATLAB to connect port 9001.
After the connection has been established, SerialForwarder application sent
2 bytes (85 32) to my MATLAB application. I read in previous posts that I
have to reply with the same 2 bytes to SerialForwarder to start the data
transmission by SerialForwarder program.
I replied with the same 2 bytes to SerialFOrwarder. But, I am not getting
any data after this from SerialForwarder java application.
Please help me, where am I doing the things wrong?
This is my MATLAB program to collect data from SerialForwarder application.
---------------------------------------------------------------------------------------------
% Create TCP/IP object 't'. Specify server machine and port number.
t = tcpip('localhost', 9001);
% Set size of receiving buffer, if needed.
set(t, 'InputBufferSize', 30000);
set(t,'ByteOrder','littleEndian');
% Open connection to the server.
fopen(t);
% Transmit data to the server (or a request for data from the server).
fprintf(t, 'GET /');
% Pause for the communication delay, if needed.
pause(1);
datain = zeros(2,1);
datain = fread(t,1,'uint16');
fprintf(1, 'byte received = %uint16\n', datain);
fprintf(t, 'GET /');
%get(t,'Status')
pause(1);
fwrite(t,datain,'uint16');
fprintf(1, 'byte sent = %uint16\n', datain);
fprintf(t, 'GET /');
%get(t,'Status')
pause(1);
data = zeros(50,1);
i=0;
for i = 1:t.BytesAvailable
data(i) = fread(t,1,'uint8');
fprintf(1, 'uint8', data(i));
end
%get(t,'Status')
% Disconnect and clean up the server connection.
fclose(t);
delete(t);
clear t
-------------------------------------------------------------------------------------------
Please help me out as this is a very important part of my project.
Vishal
--
Vishal Pal
_______________________________________________
Tinyos-help mailing list
[email protected]
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help