I HAVE ARDUINO UNO AND SIM900 GSM MODEM.... THIS IS THE CODE... I WANT TO LED ON

#include <SoftwareSerial.h>  //Include the NewSoftSerial library to send serial commands to the cellular module.

char inchar;                //Will hold the incoming character from the Serial Port.

SoftwareSerial cell(2,3);    //Create a 'fake' serial port. Pin 2 is the Rx pin, pin 3 is the Tx pin.

int led1 = 11;

int led2 = 12;

int led3 = 13;



void setup()

{    // prepare the digital output pins

pinMode(led1, OUTPUT);

pinMode(led2, OUTPUT);

pinMode(led3, OUTPUT);



digitalWrite(led1, LOW);

digitalWrite(led2, LOW);

digitalWrite(led3, LOW);

   //Initialize GSM module serial port for communication.

Serial.begin(9600);

delay(3000); // give time for GSM module to register on network etc.

Serial.println("AT+CMGF=1"); // set SMS mode to text

delay(200);

Serial.println("AT+CNMI=3,3,0,0"); // set module to send SMS data to serial out upon receipt

delay(200);
}

void loop()

{    //If a character comes in from the cellular module...

if(Serial.available() >0)

{

inchar=Serial.read();

if (inchar=='#') // OK - the start of our command

{

delay(10);

inchar=Serial.read();

if (inchar=='a')

{

delay(10);

inchar=Serial.read();

if (inchar=='0')

{

digitalWrite(led1, LOW);

}

else if (inchar=='1')

{

digitalWrite(led1, HIGH);

}

delay(10);

inchar=Serial.read();

if (inchar=='b')

{

inchar=Serial.read();

if (inchar=='0')

{

digitalWrite(led2, LOW);

}

else if (inchar=='1')

{

digitalWrite(led2, HIGH);

}

delay(10);

inchar=Serial.read();

if (inchar=='c')

{

inchar=Serial.read();

if (inchar=='0')

{

digitalWrite(led3, LOW);

}

else if (inchar=='1')

{

digitalWrite(led3, HIGH);

}

delay(10);



}

}

Serial.println("AT+CMGD=1,4"); // delete all SMS

}

}

}

}

Moderator edit: CODE TAGS ADDED.

WHERE IS T MISTAKE

Please don't shout.

Please post code in [ code ] [ /code ] tags so it displays correctly, and make sure your code is complete.

Also please tell us what the code is supposed to do, what it actually does, and what you're tried so far to find the problem.

PLEASE DON'T SHOUT.

You have a sketch that includes statements to turn the LEDs on and off. Does it compile? Does it do what you want? If not, what do you want it to do, what does it actually do, and what circuits do you have connected to it?

i want to turn on / off led using sms from my mobile

j have arduino uno and sim900 modem, i need to turn on/off led using sms from mobile... this is the code i tried... but through sms is nt wrking... if we give code in serial monitor it works.... but not wrking in sms
#a1b1c1 is the code to turn on the 3 led connected to pin 11,12,13.....

where is t mistake ????

If there is at least one character available to read, read a while bunch of them. Nope. That won't work.

The proper way to read, store, and compare serial data comes up nearly daily. Time for you to do some research.

The program you have shown only does I/O on the hardware Serial port (ie the one connected to the USB). I do not see any calls to the softwareserial"cell" you have opened...?

Also look at Arduino - Home which shows a sort of "echo" between the hardware port and the softwareserial - you should do something similar to see what you actually receive on the modem.

Lastly (in other words there is more than one error) whilst you wait correctly for the first character (Serial.available()>0) you simply assume the other 6 characters have arrived. They may or may not have arrived (I noticed the delay(10) - probably a workaround you found worked, sort of) . Either do a (Serial.available()>0) before each Serial.read OR do a (Serial.available()>=6) which means at least 6 characters have arrived.

i tried it also not working... i want to know how gsm reads t message in serial monitor?????

sms is not recieving serial window

RACE:
where is t mistake ????

You are sending your modem commands to the hardware serial port instead of the SoftwareSerial port 'cell' that you have created, which presumably is connected to the modem. You would presumably also need to read the responses from the cell SoftwareSerial port.

so, what i need to do?

You need to stop opening new threads on the same topic.

Do NOT cross-post, it makes me very CROSS.
Also, please start using code tags when posting code.
And stop SHOUTING.

Clear?

ok sir, give me example coding to turn on/off leg using gsm

give me example coding to turn on/off leg using gsm

Nice attitude.

I've just merged cross-posted threads and given you an example of how to add CODE TAGS to your posts.
Now look, you've made me shout too.

RACE:
ok sir, give me example coding to turn on/off leg using gsm

You already have some code, you just need to fix it. Several mistakes have already been pointed out to you.