Arduino GSM USSD AT-Command回复为空

时间:2015-04-17 07:38:48

标签: arduino gsm ussd

我有这个arduino代码。 GSM屏蔽连接,ussd也被发送,但我没有得到任何回复(类似于' ok')。 ussd短代码是有效的。我在这里错过了什么?或者我的代码中是否有错误? (设备:Arduino Uno,GSM支持)

欣赏有关此事的任何见解。谢谢

#include <GSM.h>
#include <GSM3ShieldV1DirectModemProvider.h>

// initialize the library instance
GSM gsmAccess;  

GSM3ShieldV1DirectModemProvider modemAccess;


// PIN Number
#define PINNUMBER ""


void setup() {   
   Serial.begin(9600);  
   // initialize the digital pin as an output.  
   Serial.println("GSM networks scanner");

   connectGSM();

   String At_COMMAND = "AT+CUSD=1,\"*#456#\"";   
   Serial.println("Sending At command");
   String reply = modemAccess.writeModemCommand(At_COMMAND,15);
   Serial.println("Sent");
   Serial.println(reply);
   Serial.println("Sent");  
}

void connectGSM(){
  boolean notConnected=true;
  Serial.println("Connecting...");
  while(notConnected){
    if(gsmAccess.begin(PINNUMBER) == GSM_READY)
      notConnected = false;
    else delay(1000);
  }
  Serial.println("Connected to GSM");
}

输出

GSM networks scanner
Connecting...
Connected to GSM
Sending At command
Sent

Sent

1 个答案:

答案 0 :(得分:0)

尝试将时间增加到1000毫秒而不是15毫秒