【发布时间】:2018-12-14 08:19:08
【问题描述】:
我正在使用 SIM808 向特定号码发送短信。但是当尝试使用 AT+CMGS=XXXXXXX 设置数字时,返回 +CMS ERROR:325。我已经将 AT+CSCS 设置为 GSM 但仍然没有运气。以下是代码:
import serial
import os, time
# Enable Serial Communication
port = serial.Serial("/dev/ttyUSB0", baudrate=9600, timeout=1)
# Transmitting AT Commands to the Modem
# '\r\n' indicates the Enter key
port.write('AT'+'\r\n')
rcv = port.read(10)
print rcv
port.write('AT+CMGF=1\r\n')
time.sleep(10)
rcv = port.read(10)
print rcv
port.write('AT+CMGS=\'9912345678\'\r\n')
time.sleep(2)
port.write('test msg')
time.sleep(2)
port.write(chr(26))
rcv = port.read(10)
print rcv
port.flush()
【问题讨论】:
-
你能发布你的代码吗?我相信错误代码 325 代表无效的输入值。再次检查您的字符编码和手机号码。
-
嗨@DarkSorrow,我已经发布了代码。我在分配号码时遇到错误。
标签: arduino raspberry-pi raspberry-pi3 sim800