Skip to main content
Post Closed as "Duplicate" by Code Gorilla, Majenko, Nick Gammon
added 664 characters in body
Source Link

I'am trying to apply USSD operation with variable codes, for example this piece of code return my account balance:

             gsm.SimpleWriteln("AT+CUSD=1,\"*100#\""); 

i want to change "*100#" to variable so gsm.SimpleWrite uses what the variable contains. I want to find how to make it work like this:

             gsm.SimpleWriteln("AT+CUSD=1,\"Variable\"");

EDIT: here is my code to give you a better view. it return balance in serial monitor.

#include "SIM900.h"



  void setup() 
    {
   Serial.begin(9600);
    Serial.println("GSM Shield testing.");
       if (gsm.begin(9600))
            Serial.println("\nstatus=READY");
      else Serial.println("\nstatus=IDLE");

         gsm.SimpleWriteln("AT+CUSD=1,\"*100#\"");
      delay(10000);
             char msg[200];
             gsm.read(msg, 200);
            Serial.print("resp: ");
            Serial.println(msg);
 }
    void loop()
     {

    }

I'am trying to apply USSD operation with variable codes, for example this piece of code return my account balance:

             gsm.SimpleWriteln("AT+CUSD=1,\"*100#\""); 

i want to change "*100#" to variable so gsm.SimpleWrite uses what the variable contains. I want to find how to make it work like this:

             gsm.SimpleWriteln("AT+CUSD=1,\"Variable\"");

I'am trying to apply USSD operation with variable codes, for example this piece of code return my account balance:

             gsm.SimpleWriteln("AT+CUSD=1,\"*100#\""); 

i want to change "*100#" to variable so gsm.SimpleWrite uses what the variable contains. I want to find how to make it work like this:

             gsm.SimpleWriteln("AT+CUSD=1,\"Variable\"");

EDIT: here is my code to give you a better view. it return balance in serial monitor.

#include "SIM900.h"



  void setup() 
    {
   Serial.begin(9600);
    Serial.println("GSM Shield testing.");
       if (gsm.begin(9600))
            Serial.println("\nstatus=READY");
      else Serial.println("\nstatus=IDLE");

         gsm.SimpleWriteln("AT+CUSD=1,\"*100#\"");
      delay(10000);
             char msg[200];
             gsm.read(msg, 200);
            Serial.print("resp: ");
            Serial.println(msg);
 }
    void loop()
     {

    }
Post Undeleted by Med. A.
Post Deleted by Med. A.
Source Link

Insert Variables In AT commandes

I'am trying to apply USSD operation with variable codes, for example this piece of code return my account balance:

             gsm.SimpleWriteln("AT+CUSD=1,\"*100#\""); 

i want to change "*100#" to variable so gsm.SimpleWrite uses what the variable contains. I want to find how to make it work like this:

             gsm.SimpleWriteln("AT+CUSD=1,\"Variable\"");