Send sms via AT Command is strange

I use the ComPort component to send SMS messages through a modem, the problem is that sometimes I get sms, sometimes sometimes I don’t get the at command in the text of the text message.

Here is my code:

procedure SendSmsCosmote(numar,text : string); const buf : Byte = 26; begin Form1.ComPort1.WriteStr('AT+CMGF=1'+#13#10); Form1.ComPort1.WriteStr('AT+CMGS="'+ numar + '"'+#13); Form1.ComPort1.WriteStr(text); Form1.ComPort1.Write(buf,1); end; 

What am I doing wrong? And why, when I read from the modem, do I get what I sent on the tx line?

+6
source share
1 answer

Try adding a little delay between the commands (or wait for the modem to respond, usually "OK").

+1
source

Source: https://habr.com/ru/post/916341/


All Articles