Go Down

Topic: USSD code and response (Read 2482 times) previous topic - next topic

bule

How to send: AT+CUSD=1,"*121#"
And I get this response:+CUSD: 2,"Stanje na Vasem racunu je 1.00 din. Kredit mozete dopuniti do 18.06.2014. Pozovite *111# i proverite koja vas ponuda ceka.",15

I need to extract text and forward to number who sent request.

mlbraga82

Hi Bule!
I'm doing a project to turn on/off a desktop computer by SMS and I needed know how to send a USSD message and read the response. My solution is :

Using a GSM library: (SIM900)

          gsm.SimpleWriteln(F("AT+CUSD=1,\"*121#\""));   //sending AT+CUSD=1,"*121#"
          delay(5000);
          char resp[100];
          gsm.read(resp, 100); //this command will send the response to the serial port and, at the same time, copy to "resp" string
          Serial.println(resp);

You can split the string using something like that:

int i=5;   //begin of string split =5, in this case
char newString[ ];
do{
   newString=resp;
   i++;
} while (i<20);  // End of string split =20, in this case

Then, now you have a newString with a text that you want.

I hope that will be usefull.

Regards!


Go Up