combining the rfid door lock code and the recieve sms-LED glow code

I am making a security system project and i require the RFID door lock and ultrasonic sensor test code and the GSM code to work one after the other. I tried it on my own but only the RFID door lock and the ultrasonic test code is working while the gsm part is not working ie. the LED does not glow when the message is sent. I am sending the code i tried. plzzzzzzzz help ASAP!! URGENT!!

#include <SoftwareSerial.h>

SoftwareSerial mySerial(10, 11); // Define SoftwareSerial pin RX, TX

int gsmDriverPin[3] = {3,4,5}; // The default digital driver pins for the GSM and GPS mode
//If you want to change the digital driver pins
//or you have a conflict with D3~D5 on Arduino board,
//you can remove the J10~J12 jumpers to reconnect other driver pins for the module!
int ledpin = 8;
char inchar;
int c, rfidArray[10];
int res = 0;
int passwordArray[10] = {50,53,49,49,56,52,49,50,13,10}; //Store the password elements here
int ledPin = 12;

void InitGsm()
{

for(int i = 0 ; i < 3; i++){
pinMode(gsmDriverPin*,OUTPUT);*

  • }*
  • pinMode(ledpin,OUTPUT);*
  • digitalWrite(5,HIGH); //Output GSM Timing*
  • delay(1500);*
  • digitalWrite(5,LOW); *
  • digitalWrite(3,LOW); //Enable the GSM mode*
  • digitalWrite(4,HIGH); //Disable the GPS mode*
  • delay(5000); //call ready*
  • delay(5000);*
  • mySerial.println(“AT+CMGD=1,4”); //Delete all SMS in box*
    }
    void setup() *
    {
    Serial.begin(9600);
    mySerial.begin(9600); //set SoftwareSerial port baud rate
    InitGsm(); //initialize GSM module
    pinMode(ledPin, OUTPUT);
    pinMode(13,OUTPUT);
    pinMode(2,OUTPUT);//attach pin 2 of Ultrasonic Sensor to vcc
    pinMode(5,OUTPUT);//attach pin 5 of Ultrasonic Sensor to GND
    _/
    — RFID PART BEGINS —*/_
    while(res==0){
    *for(int i = 0; i< 10; i++){ *
  • while(!(Serial.available()));// Start collecting the RFID information*
  • c = Serial.read();*
    _ rfidArray = c;_
    _ //Serial.println(rfidArray*);
    // Wait for next character to arrive at Serial*
    }
    * // So now we have all the data from the RFID card.
    // Let’s compare with passwordArray*
    for(int i = 0; i< 10; i++){
    if(rfidArray!=passwordArray*){
    res = 0;
    break;
    }
    else*

    * res = 1;
    }
    // Let’s check res, and light up the green LED & run Motor if the right card was swiped*

    if(res == 0)
    {
    * digitalWrite(ledPin, LOW);
    }
    else
    {
    digitalWrite(ledPin, HIGH);
    delay(3000);
    digitalWrite(ledPin, LOW);
    }
    }
    /— If wrong RFID, go back, else come out and start checking Ultrasonic —/
    }
    void loop() // run over and over
    {
    /–BEGIN ULTRASONIC Code–/
    digitalWrite(2, HIGH);
    // establish variables for duration of the ping,
    // and the distance result in inches and centimeters:
    long duration, inches, cm;
    // The PING))) is triggered by a HIGH pulse of 2 or more microseconds.
    // Give a short LOW pulse beforehand to ensure a clean HIGH pulse:
    pinMode(3, OUTPUT);// attach pin 3 to Trig*

    * digitalWrite(3, LOW);
    delayMicroseconds(2);
    digitalWrite(3, HIGH);
    delayMicroseconds(5);
    digitalWrite(3, LOW);
    // The same pin is used to read the signal from the PING))): a HIGH*

    * // pulse whose duration is the time (in microseconds) from the sending*
    * // of the ping to the reception of its echo off of an object.
    pinMode (4, INPUT);//attach pin 4 to Echo*

    * duration = pulseIn(4, HIGH);
    // convert the time into a distance*

    * inches = microsecondsToInches(duration);
    cm = microsecondsToCentimeters(duration);*_

* if(inches < 4)*
* digitalWrite(13,HIGH);*
* else*
* digitalWrite(13,LOW);*
/---- end of ultrasonic code -----/
/---- GSM Part ----/
if(mySerial.available()>0)
* {*
* inchar=mySerial.read();*
* //Serial.print(inchar); //Display the GPS/GPRS/GSM Module status*
* if(inchar==‘T’)*
* {*
* delay(10);*
* inchar=mySerial.read();*
* if (inchar==‘I’) //When the GSM module get the message, it will display the sign ‘+CMTI “SM”, 1’ in the SoftwareSerial port*
* { *
* delay(10);*
* mySerial.println(“AT+CMGR=1”); //When Arduino read the sign, send the “read” AT command to the module*
* delay(10);*
* }*
* }*
* else if (inchar==‘A’)*
* {*
* delay(10);*
* inchar=mySerial.read();*
* if (inchar==‘C’) //Thw SMS(“LH”) was display in the SoftwareSerial port, and Arduino has recognize it.*
* {*
* delay(10);*
* digitalWrite(ledpin,HIGH); //Turn on led*
* delay(50);*
* mySerial.println(“AT+CMGD=1,4”); //Delete all message*
* delay(500);*
* }*
* if (inchar==‘O’) //Thw SMS(“LH”) was display in the SoftwareSerial port, and Arduino has recognize it.*
* {*
* delay(10);*
* digitalWrite(ledpin,LOW); //Turn off led*
* delay(50);*
* mySerial.println(“AT+CMGD=1,4”);//Delete all message*
* delay(500);*
* }*
* }*
* }*
}
long microsecondsToInches(long microseconds)
{
* // According to Parallax’s datasheet for the PING))), there are*
* // 73.746 microseconds per inch (i.e. sound travels at 1130 feet per*
* // second). This gives the distance travelled by the ping, outbound*
* // and return, so we divide by 2 to get the distance of the obstacle.*
* // See: http://www.parallax.com/dl/docs/prod/acc/28015-PING-v1.3.pdf*
* return microseconds / 74 / 2;*
}
long microsecondsToCentimeters(long microseconds)
{
* // The speed of sound is 340 m/s or 29 microseconds per centimeter.*
* // The ping travels out and back, so to find the distance of the*
* // object we take half of the distance travelled.*
* return microseconds / 29 / 2;*
}

Edit your post and include code tags!

http://pastebin.com/t2BzrhEp i realized the serial.available() is not greater than 0. Plz let me know wat am i missing in the code so that the GSM part works too.

I wrote you should use code tags, not put the code onto another service. Anyway, you don't seem to use the GSM shield from Arduino, so you must provide a link to the hardware you're using. If that's not a shield, provide also a wiring diagram or a photo of your wiring. You should also describe what you think about how this sketch should work because the comments are obviously wrong, at least part of them.