Seeed-Studio / GPRS_SIM900

library for GPRS shield with sim900 module.
MIT License
138 stars 96 forks source link

Can't use sendUSSDSynchronous #22

Closed peterloveland closed 4 years ago

peterloveland commented 6 years ago

Hello,

I'm trying to use the sendUSSDSynchronous function to check the balance available on a SIM. Do you happen to have an example of how I might use this?

I'm a bit new to this whole thing, but this is what I'm trying: gprs.sendUSSDSynchronous("*100#") My assumption is I'm missing the other 2 parameters: char *resultcode + char *response

Thanks for any help!

lanselambor commented 6 years ago

@peterloveland94 Hi, can you try to manually issue AT command to check if you can use USSD service? Upload example SIM900_Serial_Debug, open serial monitor issue below commands. It's sure that what I got is not expected to you.

AT+CUSD=1,"*100#"

OK

+CUSD: 2

AT+CUSD=1,"*111*2#"

OK

+CUSD: 2
peterloveland commented 6 years ago

Thanks for the speedy response!

I can confirm that all of these commands work as intended and are issuing the correct responses, including the response from the network (the balance remaining on my SIM).

lanselambor commented 6 years ago

Please show me the response of balance, I was confused that no balance responsed to me. Thank you.

Welsyntoffie commented 5 years ago

define ballance "*120#"

char result[10]; char response[200]; //beware your memory String ballance_string;

void setup() { gprs.sendUSSDSynchronous(ballance,result,response);

ballance_string = String(response); //convert array to string Serial.println(ballance_string);

}

This worked for me. Hope it helps someone else finding this.