Click here to Skip to main content
15,888,241 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
i want to send sms usig gsm with matlab
i have written following code but not getting any result except shown below

What I have tried:

 ss=serial('COM4');
ss.baudrate=9600;
fopen(ss);
ss.Terminator = 'CR'
%char(34 ") 13 enter. 26 for ctrl z
tx ='AT';
tx1=char(13);
tx2 ='AT+CMGF=1';
tx3 ='AT+CSCS="GSM"';
tx4 ='AT+CMGS="=+9197244*****"';
tx5 ='HELLO THI IS';
tx6=char(26);

fprintf(ss,'%s',tx);
fprintf(ss,'%s',tx1);
pause(1);
fprintf(ss,'%s',tx2);
fprintf(ss,'%s',tx1);
pause(1);
fprintf(ss,'%s',tx3);
fprintf(ss,'%s',tx1);
pause(1);
fprintf(ss,'%s',tx4);
fprintf(ss,'%s',tx1);
pause(1);
fprintf(ss,'%s',tx5);
pause(1);
fprintf(ss,'%s',tx6);

getting following output

   Serial Port Object : Serial-COM4

   Communication Settings 
      Port:               COM4
      BaudRate:           9600
      Terminator:         'CR'

   Communication State 
      Status:             open
      RecordStatus:       off

   Read/Write State  
      TransferStatus:     idle
      BytesAvailable:     0
      ValuesReceived:     0
      ValuesSent:         0
Posted
Updated 13-May-17 3:46am

1 solution

you are going right bro just
do one thing
edit this one
tx4 ='AT+CMGS="=+9197244*****"';
-> x

tx4 ='AT+CMGS="97244*****"';
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900