0

I have this arduino code. GSM shield get connected and the ussd is also being sent but I am not getting any reply (something like 'ok'). The ussd short code is a valid one. What am I missing here? Or is there an error in my code? (Equipement: Arduino Uno, GSM shiled)

Appreciate any insight on this matter. Thank you

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

Output

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

Sent
  • The reason was that unlike the sms, in ussd we need to have custom functions to retrieve and decode the incoming ussd response from the network. –  Apr 24 '15 at 09:40

1 Answers1

0

Try increasing time to 1000 ms instead of 15 ms

Smfoto
  • 1