Pages: [1]   Go Down
Author Topic: USSD code and response  (Read 2216 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 47
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 2
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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!

Logged

Pages: [1]   Go Up
Jump to: