Arduino屏蔽SIM900不响应AT命令

时间:2018-05-15 14:53:57

标签: arduino serial-communication sim900

我已经连接到SIM900屏蔽的Arduino Uno(图中的那个)。 当我在Arduino上执行此代码时,我可以向我的电话号码发送消息(这就是为什么我认为Arduino和盾牌正在运行)

然而,当我尝试在串口监视器中执行AT命令到我的Arduino时,我没有得到一个" OK"响应。你能解释一下为什么我执行AT命令时没有得到回应吗?

image

/*********
  Complete project details at http://randomnerdtutorials.com  
*********/

#include <SoftwareSerial.h>

// Configure software serial port
SoftwareSerial SIM900(7, 8); 

void setup() {
  // Arduino communicates with SIM900 GSM shield at a baud rate of 19200
  // Make sure that corresponds to the baud rate of your module
  SIM900.begin(19200);
  // Give time to your GSM shield log on to network
  delay(20000);   

  // Send the SMS
  sendSMS();
}

void loop() { 

}

void sendSMS() {
  // AT command to set SIM900 to SMS mode
  SIM900.print("AT+CMGF=1\r"); 
  delay(100);

  // REPLACE THE X's WITH THE RECIPIENT'S MOBILE NUMBER
  // USE INTERNATIONAL FORMAT CODE FOR MOBILE NUMBERS
  SIM900.println("AT + CMGS = \"+212625429762\""); 
  delay(100);

  // REPLACE WITH YOUR OWN SMS MESSAGE CONTENT
  SIM900.println("Message example from Arduino Uno."); 
  delay(100);

  // End AT command with a ^Z, ASCII code 26
  SIM900.println((char)26); 
  delay(100);
  SIM900.println();
  // Give module time to send SMS
  delay(5000); 
}

0 个答案:

没有答案