Arduino uno r3 with sim900

Hi

I am testing SendSMS code of arduino. The code is given below:

// 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[i] = '\0';
        Serial.flush();
        return 0;
      }
      if(inChar!='\r')
      {
        result[i] = inChar;
        i++;
      }
    }
  }
}

It got stuck in if(gsmAccess.begin(PINNUMBER)==GSM_READY)
It uses software serial library I think.
What may be the problem? Where can I find the configuration of TX and RX pins?

Thank you

Try with this code:

//Serial Relay - Arduino will patch a
//serial link between the computer and the GPRS Shield
//at 19200 bps 8-N-1
//Computer is connected to Hardware UART
//GPRS Shield is connected to the Software UART

#include <SoftwareSerial.h>

SoftwareSerial mySerial(2, 3);

void setup()
{
mySerial.begin(19200); // the GPRS baud rate
Serial.begin(19200); // the GPRS baud rate
}

void loop()
{
if (mySerial.available())
Serial.write(mySerial.read());
if (Serial.available())
mySerial.write(Serial.read());
}

After you run this code, you can send AT commands (via SSCOM3.2 or another terminal) and send a SMS

AT+CMGF=1
reply OK
AT+CMGS="+(country code)(area code) Cel #"
The serial monitor shows the follow character,

type the message and after that CTRL+Z
reply
+CMGS:xx
OK

You`ll receive the SMS in the target cel phone.

Try with this code.
//change the destination number

void setup()
{
Serial.begin(9600);
delay(5000);

}

void loop()
{
Serial.println("AT");
delay(1000);
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CMGS="1234567890""); //CHANGE TO DESTINATION NUMBER
delay(1000);
Serial.print("hi");
Serial.write(26);
delay(1000);
}

aqibisl786, hi from Ecuador, good code, simple and efficient,thanks a lot, i need an example for arduino to understand many details and continue working with my PIC.