【问题标题】:Arduino GSM SIM900 does not receiving messagesArduino GSM SIM900 不接收消息
【发布时间】:2015-12-25 11:08:15
【问题描述】:

以下 URL 将出现在我的 GSM 模块中,它包含在 SIM900 模块的数据表中。

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

我只在 GSM 模块和 Arduino mega board 之间连接了 RX、TX、GND 和 PWR 引脚。 可以正常发送短信,但无法接收短信。

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

#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){};
  }

}

【问题讨论】:

    标签: arduino sms gsm sim900


    【解决方案1】:

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

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

    所以你的 setuo 循环看起来像这样

    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);
    }
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2015-12-21
      • 1970-01-01
      • 1970-01-01
      • 2014-05-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多