PIR Motion to activated SMS alert

Please i have compile this code without any error but when i upload it to arduino it seems not to work..am not getting any sms alert ..is there any thing wrong with this code ?

#include <SoftwareSerial.h>
SoftwareSerial SIM900(0, 1);

/*
 * PIR sensor tester
 */
 
int ledPin = 13;                // choose the pin for the LED
int inputPin = 2;               // choose the input pin (for PIR sensor)
int pirState = LOW;             // we start, assuming no motion detected
int val = 0;                    // variable for reading the pin status


 
void setup()
{
  pinMode(ledPin, OUTPUT);      // declare LED as output
  pinMode(inputPin, INPUT);     // declare sensor as input
  Serial.begin(9600);
  SIM900.begin(9600);
  SIM900power();  
  delay(20000);  // give time to log on to network.
}
 
void SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
  digitalWrite(13, HIGH);
  delay(1000);
  digitalWrite(13, LOW);
  delay(5000);
}
 
void sendSMS()
{
  SIM900.print("AT+CMGF=1\r");                                                        // AT command to send SMS message
  delay(1000);
  SIM900.println("AT + CMGS = \"+639368266683\"");                                     // recipient's mobile number, in international format
  delay(1000);
  SIM900.println("Hello, world. This is a text message from an Arduino Mega 2560.");        // message to send
  delay(1000);
  SIM900.println((char)26);                       // End AT command with a ^Z, ASCII code 26
  delay(1000);
  SIM900.println();
  delay(5000);                                     // give module time to send SMS
  SIM900power();                                   // turn off module
}
 
void loop()


{
    val = digitalRead(inputPin);  // read input value
  if (val == HIGH) {            // check if the input is HIGH
    digitalWrite(ledPin, HIGH);  // turn LED ON
    if (pirState == LOW) {
      // we have just turned on
      Serial.println("Motion detected!");
      // We only want to print on the output change, not state
      pirState = HIGH;
    }
  } else {
    digitalWrite(ledPin, LOW); // turn LED OFF
    if (pirState == HIGH){
      // we have just turned of
      Serial.println("Motion ended!");
      // We only want to print on the output change, not state
      pirState = LOW;
    }
  }
}

What happens if you take everything out of loop and put your call to sendSMS() at the end of setup()?

Like how ? More detailed explanation please .

Short of writing it for you I can't think of a way to give a more detailed explanation. Which bit are you having difficulty with? The 'take everything out of loop' part or the 'put your call to sendSMS() at the end of setup()' part?

'put your call to sendSMS() at the end of setup()' part...that's where I have a problem

Just add the line sendSMS(); after the delay that gives you time to connect to the network, before the closing brace.

Then when you reset the Arduino it should send one SMS to the recipients cell / mobile phone.