问题描述
我试图发送一个文本“ alert”,但它变成了“ 5w”,发出了其他类型的消息,它们最终都是一些奇怪的字符,例如=ìteèNñq¥tΔ6M#ΦReÅZ¡Δf¿£AfåP3TÅbVÉè/&pøo3Λ+ XKw6 ΣPΨΓ8FwΘBΩ。我不确定我做错了什么,有人可以帮助我解决这个问题吗?
Public Sub New(ByRef COMMPORT As String)
'initialize all values
SMSPort = New SerialPort
With SMSPort
.PortName = COMMPORT
.Baudrate = 115200
.Parity = Parity.None
.DataBits = 8
.StopBits = StopBits.One
.Handshake = Handshake.RequestToSend
.DtrEnable = True
.RtsEnable = True
.NewLine = vbCrLf
End With
End Sub
Public Function SendSMS() As Boolean
If SMSPort.IsOpen = True Then
'sending AT commands
SMSPort.WriteLine("AT")
SMSPort.WriteLine("AT+CMGF=1" & vbCrLf) 'set command message format to text mode(1)
SMSPort.WriteLine("AT+CMGS= " & Chr(34) + phonenumber + Chr(34) & vbCrLf)
_ContSMS = False
SMSPort.WriteLine("alert" & vbCrLf & Chr(26)) 'SMS sending
SMSPort.Close()
End If
End Function
Public Sub open()
If Not (SMSPort.IsOpen = True) Then
SMSPort.open()
End If
End Sub
Public Sub Close()
If SMSPort.IsOpen = True Then
SMSPort.Close()
End If
End Sub
解决方法
暂无找到可以解决该程序问题的有效方法,小编努力寻找整理中!
如果你已经找到好的解决方法,欢迎将解决方案带上本链接一起发送给小编。
小编邮箱:dio#foxmail.com (将#修改为@)