首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >Arduino GSM SIM900不接收消息

Arduino GSM SIM900不接收消息
EN

Stack Overflow用户
提问于 2015-12-25 11:08:15
回答 1查看 4.3K关注 0票数 1

下面的网址将显示我的GSM模块,它包括SIM900模块的数据表。

http://www.pennybuying.com/gsm-gprs-module-sim900-development-board-lbs-mms-support-arduino-uno-ttl-rs232.html

我只连接了RX,TX,GND和PWR引脚之间的GSM模块和Arduino超级板。发送短信是正常的工作,但接收短信是不工作的。

这是发送短信的Arduino代码-(参考- http://tronixstuff.com/2014/01/08/tutorial-arduino-and-sim900-gsm-modules/)

代码语言:javascript
复制
#include <SoftwareSerial.h>
SoftwareSerial SIM900(15,14);

char incoming_char=0;

void setup()
{
  Serial.begin(19200); // for serial monitor
  SIM900.begin(19200); // for GSM shield
  SIM900power();  // turn on shield
  delay(20000);  // give time to log on to network.

  SIM900.print("AT+CMGF=1\r");  // set SMS mode to text
  delay(100);
  SIM900.print("AT+CNMI=2,2,0,0,0\r"); 
  // blurt out contents of new SMS upon receipt to the GSM shield's serial out
  delay(100);
}

void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(9, HIGH);
  delay(1000);
  digitalWrite(9, LOW);
  delay(7000);
}

void loop()
{
  // Now we simply display any text that the GSM shield sends out on the serial monitor
  Serial.println("loop");
  if(SIM900.available() > 0)
  {
     Serial.print("waiting");
    incoming_char=SIM900.read(); //Get the character from the cellular serial port.
    Serial.print(incoming_char); //Print the incoming character to the terminal.
    while(1){};
  }

}
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2015-12-26 10:06:53

尝试在您的SIM900.print("AT+CMGD=1,4\r");中添加setup()。我也遇到了类似的问题,原因是信息的sim卡内存已经满了.

如果sim内存中没有空间,您将不会收到任何消息或通知!

所以你的setuo循环应该是这样的

代码语言:javascript
复制
void setup()
{
    Serial.begin(19200); // for serial monitor
    SIM900.begin(19200); // for GSM shield
    SIM900power();  // turn on shield
    delay(20000);  // give time to log on to network.

    SIM900.print("AT+CMGF=1\r");  // set SMS mode to text
    delay(100);
    SIM900.print("AT+CMGD=1,4\r");  // Deletes all SMS saved in SIM memory
    delay(100);
    SIM900.print("AT+CNMI=2,2,0,0,0\r"); 
    // blurt out contents of new SMS upon receipt to the GSM shield's serial out
     delay(100);
}
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/34462328

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档