How to send an sms

45 ビュー (過去 30 日間)
kash
kash 2014 年 3 月 7 日
コメント済み: farhan 2022 年 11 月 3 日
I am working on a concept that if the process gets over i want to send sms to my mobile for this i used the code
i changed the number and com port but unable to send sms,i get my modem details displayed in command window ,but sms is not sent,i want to send sms to indian mobiles kindly help
  2 件のコメント
shoaib hmed
shoaib hmed 2017 年 12 月 16 日
Maybe You enterd +971******
it works for me
%%%%%%%%%%%%%%%%Matlab code for sending SMS%%%%%%%%%%%% try clc; clear all; global BytesAvail; global A; global B; tx ='AT'; tx1=char(13); tx2=char(26); tx3='AT+CMGS="923159076826"'; % You have to replace this with the Receiver's Phone number tx4= ' This is a test msg '; %This is the msg body tx5='AT+CMGF=1';
s = serial('COM4', 'BaudRate', 230400); % You have to replace this with your 3G modem's COMport number fopen(s); s.Terminator = 'CR';
fprintf(s,'%s', tx); fprintf(s,'%s', tx1); BytesAvail=s.BytesAvailable; if(BytesAvail > 0), A=fread(s,BytesAvail,'char'); end A; sprintf('%c', A) %%%%%%%%%%%%%%%Send SMS%%%%%%%%%%%% fprintf(s,'%s', tx5); fprintf(s,'%s', tx1); fprintf(s,'%s', tx3); fprintf(s,'%s', tx1); fprintf(s,'%s', tx4); fprintf(s,'%s', tx2);
BytesAvail=s.BytesAvailable; B=fread(s,BytesAvail,'char'); fclose(s);
catch aException fclose(s); error(message('MATLAB:serial:fprintf:opfailed', aException.message)); end
if true
% code
end
farhan
farhan 2022 年 11 月 3 日
if i use 4g modem. will it work?

サインインしてコメントする。

回答 (2 件)

Doug Hull
Doug Hull 2014 年 3 月 7 日
  1 件のコメント
kash
kash 2014 年 3 月 8 日
ya i tried even this ,the messgae is sent to mail,but in the in box ,it says that the message cannot be delivered,i changed the my carrie name ,even though message is not sent,kindly help

サインインしてコメントする。


HEPHZIBAH THOMAS
HEPHZIBAH THOMAS 2018 年 11 月 13 日

カテゴリ

Help Center および File ExchangeLicensing on Cloud Platforms についてさらに検索

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by