6744| 6
|
[求助] SIM800H库使用出现问题,麻烦进来看一下 |
本帖最后由 GG1101 于 2017-6-20 21:02 编辑 我前天在论坛上下载了SIM800H库文件,在使用 使能来电显示例程 的时候出现问题。用设定的号码手机打电话给SIM800H也打不通,后来我通过LCD1602打印 str 发现问题所在[mw_shl_code=c,true]#include <sim800cmd.h> //initialize the library instance //fundebug is an application callback function,when someon is calling. Sim800Cmd sim800demo(fundebug1); //phone number buffer char str[15] = {'\0'}; //the setup routine runs once when you press reset: void setup() { //initialize the digital pin as an output. //initialize SIM800H,return 1 when initialize success. while((sim800demo.sim800init()) == 0); //enable SIM800H Modular Caller ID sim800demo.DisplayPhoneNumber(OPEN); } //the loop routine runs over and over again forever: void loop() { } //application callback function //Note that not too much to handle tasks in this function void fundebug1(void) { //get the phone number sim800demo.getCallnumber(str); if(memcmp(str,"18668603728",11) == 0) { sim800demo.answerTelephone(); //answer } else { sim800demo.cancelCall();//hangs up } }[/mw_shl_code] 我用LCD1602打印出 str ,发现11位号码只显示了9位,前面的两位没有。根本不是11位完整的号码,而是668603728。出现这种情况不知怎么回事。 |
© 2013-2024 Comsenz Inc. Powered by Discuz! X3.4 Licensed