Hey,
new code it is now working.
function [ret_val] = ReadTeapacket (srl_handle, term_char)
% parameter term_char is optional, if not specified
% then CR = '\r' = 13dec is the default.
% srl_write(comid,'\r');
aa = [0,0,0]
# uint8_t accelerometerPacket[10] = { 'A', 0,0, ';', 0,0, ';', 0,0, '\n' };
mydata = [0,0,0,0,0,0,0,0,0,0];
if(nargin == 1)
term_char = 13;
end
not_terminated = true;
while not_terminated
val = srl_read(srl_handle, 1);
if(val == term_char)
mydata = srl_read(srl_handle,10);
aa(1) = (deserializeInt([mydata(2),mydata(3)]));
aa(2) = (deserializeInt([mydata(5),mydata(6)]));
aa(3) = (deserializeInt([mydata(8),mydata(9)]));
not_terminated = false;
end
% Add char received to array
retval = aa;
end
Tom