我正在使用此代码与股票GSM调制解调器交谈......(Telit / Simcom等)
// ------------------------------
sprintf(localbuf, "AT+CMGS=\"%s\"\r", recipient);
Serial1.write(localbuf); // initiate the SMS conversation
if (waitFor(5000, "> ", "ERR")) {
sprintf(localbuf, "%s%c", textMessage, CTRL_Z);
Serial1.write(localbuf); // send the message body
//... I wait for the +CMGS: response here - all good
} else {
Serial.write("\r\n-- SMS >PROMPT FAIL --");
retval = false;
}
... and move on
第一条消息 - 没问题 - 它运行正常。 如果我做其他事情并回来发送另一个 - 没问题。 包括其他调制解调器对话(CSQ,CCLK等)
但是如果我尝试将一个以上的消息发送到一起(松散循环),则第二个+ CMGS请求无法返回'>'提示......?
任何想法。 提前致谢
答案 0 :(得分:1)
已解决 - 嗯 - 到目前为止一直很好( SFSG ?)
我发现 如果我在最后一次CMGS之后暂停了一秒:......收到<。em> - 以下消息按预期工作。
所以我想那就是好的&#39;真的不行(!),无论我之前尝试过哪种测试或轮询 - 调制解调器根本就没有准备就绪,直到它准备就绪。
感谢阅读。我希望这有助于其他人。
编辑:数据表在连续命令之间引用20mS,但它更像200mS inworst case ...