Click here to Skip to main content
15,888,610 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am trying to write a send SMS program using SIMCOM 900A. With My below code I am facing the problems...

1.
sending when getting serialport received-data as
> AT+CMGS="9674642260"
TESTING SMS-1


It is sending the message text preceded by the entire serialport received data.
message sent : <pre>ATAT+CMGS="9674642260"
TESTING SMS-1


2.
But not sending SMS when received-data is
AT+CMGS="9674642260"
TESTING SMS-1
> 


if I click the send button again then it is sending the sms successfully but again with entire command set + message text.

can anyone help me where to modify my current code. Also I need to send the message to multiple numbers.
Thanks in Advance.

What I have tried:

my send button code:

<pre> If SerialPort1.IsOpen Then
            SerialPort1.Close()
        End If

        SerialPort1.Open()
        Try
            With SerialPort1
                .Write("AT" & vbCrLf)
                Threading.Thread.Sleep(1000)
                ' .Write("AT+COPS?" & vbCrLf)
                ' Threading.Thread.Sleep(1000)
                .Write("AT+CMGF=1" & vbCrLf)
                Threading.Thread.Sleep(1000)
                .Write("AT+CMGS=" & Chr(34) & txtNumber.Text & Chr(34) & vbCrLf)
                .Write(txtMsg.Text & Chr(26))
                Threading.Thread.Sleep(1000)
                '.Write("AT" & vbCrLf)
            End With
            rcvData.Text = recData.ToString
            SerialPort1.Close()
        Catch ex As Exception

        End Try
Posted
Updated 7-Apr-17 22:09pm

1 solution

 
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