AT命令

命令解析方法类似scanf.

1 没有精度控制,但有宽度控制。

2 空格,TAB键,回车键,非法数据(如对 “%d” 输入 “3H”时,H为非法字符 )即认为该数据结束,如果输入了非法数据,键盘缓 
冲区就可能还个有残余信息问题https  ://blog.csdn.net/p312011150/article/details/78866884

  scanf( "%d/n ",&a);//这里多了一个回车符/n 

  scanf( "%d ",&a) //以上2种输入2个字符才算结束。

解决空白符方法: 
for( i = 0; i < n; i++){ 
scanf( "%c ",&c[i]); 
fflush(stdin);//刷新缓冲区 或者不用scanf,而用gets()函数

3 数据发送和解析:

printf("AT+QIDEACT=1 ");//去激活
delay_ms(500);
strx=strstr((const char*)RxBuffer,(const char*)"OK");//开启成功,解析
while(strx==NULL)
{

  //重发一次

}

原文地址:https://www.cnblogs.com/jieruishu/p/10711898.html