极客工坊

 找回密码
 注册

QQ登录

只需一步,快速开始

查看: 10180|回复: 0

还是sim900求助!谢谢各位!

[复制链接]
发表于 2015-1-14 15:05:23 | 显示全部楼层 |阅读模式
本帖最后由 wdb_9955 于 2015-1-14 16:55 编辑

下面的代码是按照网上的AT指令来的, 为什么不行,指令是读取所有短信。谢谢各位大牛!
#include <SoftwareSerial.h>
#include <String.h>
SoftwareSerial mySerial(7, 8);
void setup()
{
mySerial.begin(19200);               // the GPRS baud rate   
Serial.begin(19200);    // the GPRS baud rate
delay(500);
}
void loop()
{  if (Serial.available())
   switch(Serial.read())
  {
     case 'd':
      DialVoiceCall();
      break;
  }
if (mySerial.available())
   Serial.write(mySerial.read());
}


void DialVoiceCall()
{ mySerial.println("AT+CMGL="ALL"");
   delay(100);
   mySerial.println();
}

另外把改成"AT+CMGR=1” 读取位置1的 信息,结果如下。怎样才能让我能读懂它?

AT+CMGR=1

+CMGR: "REC READ","10658139120450245350","","14/12/29,14:49:09+32"
4E2D56FD79FB52A863D09192FF1A60A85DF2514D8D3983B75F9700310033003990AE7BB1FF0C8BF7767B5F556FC06D3B5E768BBE7F6E548D942A0253664B7390A7EFFC5DE9077D4E1046267B51B4869E00D00A060040700003A0200F07902001030000380300E0630600F

OK

终于读到能看懂的了。请教短信内容我如何存到字符串里?
AT+CMGR=1;


+CMGR: "REC READ","+86139xxxxxxxx","","15/01/14,16:11:41+32"
#1 open

OK
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

Archiver|联系我们|极客工坊

GMT+8, 2026-6-10 05:06 , Processed in 0.034842 second(s), 17 queries .

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表