arduino uno/sim900 HELP ME PLEASE

hello everybody,

Arduino Uno and have a module SIM900 I'm calling rx tx to d0 d1 right?
i want to control an output using a sms, but I can not, I'm using this code,

char smsbuffer[160];
char n[20];
int inc=10;
int porta = 8;
char number[]="+351977756938";
void setup() {
pinMode(porta,OUTPUT);
}
void loop(){
int pos=0;
if(!strcmp(smsbuffer,"B")) {
Serial.println("BLOQUEADO");
digitalWrite(porta,LOW);
}
if(!strcmp(smsbuffer,"L")) {
Serial.println("LIBERADO");
digitalWrite(porta,HIGH);
}
delsms();
}
void delsms(){
for (int i=0; i<1; i++);}

Help...

void delsms(){
for (int i=0; i<1; i++);}

What the heck is this supposed to be doing?

Don't you suppose that you should be reading from the device connected to the serial port? You never assign a value to smsbuffer, so it's a mystery why you expect it to equal "B" or "L".

Take a look at the link in my signature.

hello,
want to control an outlet with a sms, but you can not.
I'm using Arduino UNO and SIM900 GPRS module v1.0.
the pins are 0.1 Tx Rx?
on the board SIM900 have led the net to flash.
My problem may be the code, I am getting crazy.

I put this code and nothing.

include <SoftwareSerial.h>

char inchar; // Will hold the incoming character from the GSM shield
SoftwareSerial SIM900(0, 1);

int led = 13;

void setup()
{
Serial.begin(19200);
// set up the digital pins to control
pinMode(led, OUTPUT);
digitalWrite(led, LOW);

// wake up the GSM shield
SIM900.begin(19200);
delay(20000); // give time to log on to network.
SIM900.print("AT+CMGF=1\r"); // set SMS mode to text
delay(100);
SIM900.print("AT+CNMI=2,2,0,0,0\r");
// blurt out contents of new SMS upon receipt to the GSM shield's serial out
delay(100);
Serial.println("Ready...");
}

void loop()
{
//If a character comes in from the cellular module...
if(SIM900.available() >0)
{
inchar=SIM900.read();
if (inchar=='#')
{
delay(10);

inchar=SIM900.read();
if (inchar=='a')
{
delay(10);
inchar=SIM900.read();
if (inchar=='0')
{
digitalWrite(led, LOW);
}
else if (inchar=='1')
{
digitalWrite(led, HIGH);
}
delay(10);
// SIM900.println("AT+CMGD=1,4"); // delete all SMS
}
}
}
}

You can't use pins 0 & 1 to communicate with the shield AND serial monitor. One or the other.

And seeing as you have hardware serial on pins 0 & 1, you wouldn't use SoftwareSerial on those pins either.

Dannable,
you can do a simple code to command an output by sms for test?

Thanks a lot

Nothing wrong with the code you displayed, just probably using the wrong pins (and not in code tags HINT). Which shield are you using?

if(SIM900.available() >0)
{
inchar=SIM900.read();
if (inchar=='#')
{
delay(10);

inchar=SIM900.read();
if (inchar=='a')
{

This not bullet prof. if someone dials to the sim card inserted on the SIM900 it will appear on the serial port "RING".
That string will trigger your if(SIM900.available() >0) and then all the ifs will fail
Your code must be waiting to see when an SMS has arrived, when arrived get the position of that SMS, read it and parse it to get the body of the message, who send it and finally execute something using a strcmp() according with the body of the message