Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/arduino/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Arduino GSM不响应AT命令_Arduino_Gsm_Sim900 - Fatal编程技术网

Arduino GSM不响应AT命令

Arduino GSM不响应AT命令,arduino,gsm,sim900,Arduino,Gsm,Sim900,我使用的是GSM 900A调制解调器,需要5V电源。我正在连接Arduino UNO。我通过arduino 5V和GND引脚为调制解调器供电。我正在将RXD引脚连接到arduino的TX(引脚1),将RXD引脚连接到arduino的RX(引脚0),并将GND连接到arduino的GND,即引脚14。我正在运行基本示例代码,但GSM没有响应。我也尝试过其他软件,如Putty,但我无法编写任何AT命令,请帮助我。当我使用以下代码测试调制解调器时: /* This example tests to

我使用的是GSM 900A调制解调器,需要5V电源。我正在连接Arduino UNO。我通过arduino 5V和GND引脚为调制解调器供电。我正在将RXD引脚连接到arduino的TX(引脚1),将RXD引脚连接到arduino的RX(引脚0),并将GND连接到arduino的GND,即引脚14。我正在运行基本示例代码,但GSM没有响应。我也尝试过其他软件,如Putty,但我无法编写任何AT命令,请帮助我。当我使用以下代码测试调制解调器时:

/*

 This example tests to see if the modem of the
 GSM shield is working correctly. You do not need
 a SIM card for this example.

 Circuit:
 * GSM shield attached

 Created 12 Jun 2012
 by David del Peral
 modified 21 Nov 2012
 by Tom Igoe

 http://www.arduino.cc/en/Tutorial/GSMToolsTestModem

 This sample code is part of the public domain

 */

// libraries
#include <GSM.h>

// modem verification object
GSMModem modem;

// IMEI variable
String IMEI = "";

void setup() {
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  // start modem test (reset and check response)
  Serial.print("Starting modem test...");
  if (modem.begin()) {
    Serial.println("modem.begin() succeeded");
  } else {
    Serial.println("ERROR, no modem answer.");
  }
}

void loop() {
  // get modem IMEI
  Serial.print("Checking IMEI...");
  IMEI = modem.getIMEI();

  // check IMEI response
  if (IMEI != NULL) {
    // show IMEI in serial monitor
    Serial.println("Modem's IMEI: " + IMEI);
    // reset modem to check booting:
    Serial.print("Resetting modem...");
    modem.begin();
    // get and check IMEI one more time
    if (modem.getIMEI() != NULL) {
      Serial.println("Modem is functoning properly");
    } else {
      Serial.println("Error: getIMEI() failed after modem.begin()");
    }
  } else {
    Serial.println("Error: Could not get IMEI");
  }
  // do nothing:
  while (true);
}
/*
此示例测试的目的是查看
GSM屏蔽正常工作。你不需要
本例中的SIM卡。
线路:
*GSM屏蔽已连接
创建于2012年6月12日
大卫·德尔·佩拉尔
2012年11月21日修改
汤姆·伊戈
http://www.arduino.cc/en/Tutorial/GSMToolsTestModem
此示例代码是公共域的一部分
*/
//图书馆
#包括
//调制解调器验证对象
GSMModem调制解调器;
//IMEI变量
字符串IMEI=“”;
无效设置(){
//初始化串行通信并等待端口打开:
Serial.begin(9600);
而(!串行){
;//等待串行端口连接。仅Leonardo需要
}
//启动调制解调器测试(重置并检查响应)
串行打印(“启动调制解调器测试…”);
if(modem.begin()){
Serial.println(“modem.begin()成功”);
}否则{
Serial.println(“错误,没有调制解调器应答”);
}
}
void循环(){
//获取调制解调器IMEI
串行打印(“检查IMEI…”);
IMEI=modem.getIMEI();
//检查IMEI响应
if(IMEI!=NULL){
//在串行监视器中显示IMEI
Serial.println(“调制解调器的IMEI:+IMEI”);
//重置调制解调器以检查引导:
串行打印(“重置调制解调器…”);
modem.begin();
//再次获取并检查IMEI
if(modem.getIMEI()!=NULL){
Serial.println(“调制解调器正常工作”);
}否则{
Serial.println(“错误:在modem.begin()之后getIMEI()失败”);
}
}否则{
Serial.println(“错误:无法获取IMEI”);
}
//什么也不做:
虽然(正确);
}
我在串行监视器上获得9600波特率的输出:


正在启动调制解调器测试…错误,没有调制解调器应答。检查IMEI…调制解调器的IMEI:0重置调制解调器…调制解调器工作正常

我认为这与您的电源有关,请尝试使用适配器,该适配器输出500mA到1A的电流