GSM shield not working

i've used the build in coding in Arduino IDE of GSM(Send SMS)..
But it does not working. it just popup the "SMS Message Sender"..

is there have to change the coding?

// Include the GSM library
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;

void setup()
{
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for Leonardo only
}

Serial.println("SMS Messages Sender");

// connection state
boolean notConnected = true;

// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}

Serial.println("GSM initialized");
}

void loop()
{

Serial.print("Enter a mobile number: ");
char remoteNum[20]; // telephone number to send sms
readSerial(remoteNum);
Serial.println(remoteNum);

// sms text
Serial.print("Now, enter SMS content: ");
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);

// send the message
sms.beginSMS(remoteNum);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}

/*
Read input serial
*/
int readSerial(char result[])
{
int i = 0;
while(1)
{
while (Serial.available() > 0)
{
char inChar = Serial.read();
if (inChar == '\n')
{
result = '\0';

  • Serial.flush();*
  • return 0;*
  • }*
  • if(inChar!='\r')*
  • {*
    _ result = inChar;_
    * i++;*
    * }*
    * }*
    * }*
    }

Please edit your post to put your code withing `` tags. You can use the '#' button, or ready the sticky on how to use the forum at the top of this board for full instructions.

Which shield are you using? Link please.

dannable:
Please edit your post to put your code withing `` tags. You can use the '#' button, or ready the sticky on how to use the forum at the top of this board for full instructions.

Which shield are you using? Link please.

Arduino uno with GSM shield..
http://arduino.cc/en/Main/ArduinoGSMShield

The posted code looks fairly standard but

 result = '\0';

doesn't look right.

According to the instructions:

Make sure the serial monitor is set to send a newline when you press return.

Have you done that? On my IDE it's a selection box at the bottom of the window.

Also,

dannable:
The posted code looks fairly standard but

 result = '\0';

doesn't look right.

According to the instructions:

Make sure the serial monitor is set to send a newline when you press return.

Have you done that? On my IDE it's a selection box at the bottom of the window.

Also,

yes, I've done that.. also not working..

Have you tried using a SerialRelay sketch to make sure that everything is working OK?

If not I'd try that.

dannable:
Have you tried using a SerialRelay sketch to make sure that everything is working OK?

If not I'd try that.

SerialRelay? not yet because i don't how to use SerialRelay..

Which Arduino are you using?

There is a copy of SerialRelay and instructions in my sig link.

Don't forget to change the SoftwareSerial pins to suit the shield you are using.