Problems:
- I am able to use hyperterminal to send SMS via COM9. All good.
- But I cannot properly use AT commands in matlab to do the same thing. I even cannot pass the first "AT" step. The error I received is "Unexpected Error: Unexpected Error: An error occurred during writing." It seems coming from fprintf. Help!
Here is the codes:
try
s = serial('COM9','BaudRate',9600);
fopen(s);
tx='AT';
tx1=char(13);
tx2=char(10);
fprintf(s, '%s', sprintf('%s%s%s', tx, tx1, tx2));
out = fscanf(s);
disp(out);
fclose(s);
catch aException
fclose(s);
error(message('MATLAB:serial:fprintf:opfailed', aException.message));