Shield GSM iComSat, encender led con sms Arduino UNO

Hola, por favor necesito ayuda debo hacer un proyecto con un shield GSM de iComSat tengo que encender y apagar un led con un sms, pero ya busque en la web y no encontre mucha información para este proyecto, encontre este ide para probar el modulo y enviar un sms al celular y efectivamente funciona es codigo es este:

#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
SMSGSM sms;
boolean started=false;

void setup()
{
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");

if (gsm.begin(2400)){
Serial.println("\nstatus=READY");
started=true;
}
else Serial.println("\nstatus=IDLE");

if(started){
if (sms.SendSMS("+6148123123123", "SMS from Arduino"))
Serial.println("\nSMS sent OK");
}

};

void loop()
{

}

ya lo probe y funciona pero necesito un código para encender y apagar un led con arduino UNO.
por favor si alguien podria ayudarme le estare muy agradecido. gracias

Espero funcione :slight_smile:

#include <SoftwareSerial.h>
char inchar; // Will hold the incoming character from the GSM shield
SoftwareSerial SIM900(7, 8);

int led1 = 10;
int led2 = 11;
int led3 = 12;
int led4 = 13;

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

// wake up the GSM shield
SIM900power();
SIM900.begin(9600);
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 SIM900power()
// software equivalent of pressing the GSM shield "power" button
{
digitalWrite(9, HIGH);
delay(1000);
digitalWrite(9, LOW);
delay(5000);
}

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(led1, LOW);
}
else if (inchar=='1')
{
digitalWrite(led1, HIGH);
}
delay(10);
inchar=SIM900.read();
if (inchar=='b')
{
inchar=SIM900.read();
if (inchar=='0')
{
digitalWrite(led2, LOW);
}
else if (inchar=='1')
{
digitalWrite(led2, HIGH);
}
delay(10);
inchar=SIM900.read();
if (inchar=='c')
{
inchar=SIM900.read();
if (inchar=='0')
{
digitalWrite(led3, LOW);
}
else if (inchar=='1')
{
digitalWrite(led3, HIGH);
}
delay(10);
inchar=SIM900.read();
if (inchar=='d')
{
delay(10);
inchar=SIM900.read();
if (inchar=='0')
{
digitalWrite(led4, LOW);
}
else if (inchar=='1')
{
digitalWrite(led4, HIGH);
}
delay(10);
}
}
SIM900.println("AT+CMGD=1,4"); // delete all SMS
}
}
}
}
}

Me gustaría mencionar que eh ocupado la librería "sms.h" y "SIM900.h" con sus funciones y me ha funcionado de maravilla con Arduino ONE, sinembargo por la complejidad de mi proyecto requiero de más memoria y me tuve que mudar a Arduino MEGA pero estas librerías ya no funcionan correctamente con el MEGA; encontré un post donde se tienen que modificar las librerias para dar de alta la opción #definMEGA pero no tuve éxito. Así que estoy comenzando a investigar y usar comandos AT para una GSM/GPRS Shield (SIM900). Quiero decirles que ya puede leer, borrar y enviar mensajes con comandos AT pero no eh sabido como almacenar el mensaje en una variable para así exactamente poder mandar una señal digital por la salida del Arduino.

Analisé el código de GeovanniGomezP y de alguna manera ya había intententado hacer lo mismo pero tampoco resultó y sigo sin comprender por qué. Si alguien ah conseguido una manera de poder almacenar los datos en una variable de forma rápida y sencilla esperaría que lo postearan, es genial poder tener control de las cosas con el celular. :slight_smile: