Reputation: 11768
I am using ComPort component to send SMS messages via a modem the problem is that sometimes i get sms sometimes not sometimes i get the at commands in the body 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 I get what I sent on the tx line?
Upvotes: 6
Views: 3576
Reputation: 6137
Try adding slight delay between commands (or wait for modem reply, "OK" usually).
Upvotes: 1