i think it's a better idea to modify the code from this project http://scuola.arduino.cc/lesson/LVEVK1a/Using_SMS_messages_to_control_LED_color that uses tha same gsm shield with mine
This code needed many changes so i did this :
/*
***** The circuit *****
For this project you need;
*Arduino Uno
*Arduino GSM shield*WS2801 LED pixels connected to PIN 6
*5V Power source for the LED string
*12V Power source for the UNO and GSM shield*/
// **** 1 Libraries, definitions and global variables ****
#include <GSM.h> // This includes the GSM library, included in your Arduino IDE
#define PINNUMBER "" // declaration of the constant PINNUMBER used to push the pin number of the SIM card
#define PIN 6 // declaration of the constant PIN, and setting it to output nr. 6GSM gsmAccess; // opens up GSM access on the shield.
GSM_SMS sms;char remoteNumber[20]; // Variable to store the remote number from the modem.
char c; //Variable for reading the sms messages from the SIM cardint x=0; //Counter for the number of SMS messages processed
char lastm; //Variable to stop SMS replying
String lastMess; //for storing the whole message// **** 2 Setup ****
void setup() {
//Setup for SMS recieving. Serial setup makes it possible to monitor the status on your PC while connected
Serial.begin(9600);
Serial.println("SMS Recieving");boolean notConnected = true; // this defines a variable that indicates no GSM connection if true
while(notConnected) { // if there is no connection, the program runs gsmAcess. gsmAcess returns GSM_READY when connected
if(gsmAccess.begin(PINNUMBER"0462")==GSM_READY) // If you have a PIN number on your SIM card, write it as parameters here in quotes. PINNUMBER"9876"
notConnected = false;
else {
//messages printed on the serial monitor or LCD screen, then it tries again in 1000 milliseconds
Serial.println("No connection");}
}
// if connection is established
Serial.println("GSM connected"); //GSM connected
Serial.println("Waiting"); //Waiting for SMS}
// **** 3 The loop ****
void loop() {
lastMess = "";
//reading messages
if (sms.available()) // if there are SMS on the SIM card
{
x++; //message counter adds one
sms.remoteNumber(remoteNumber, 20);//Show the message on monitor
Serial.println("Messages received from");
Serial.println(remoteNumber); //Prints senders number on the serial monitor
Serial.println("Message:");while(c=sms.read()) {
String nextChar = String (c);
String Mess = (lastMess + nextChar);
lastMess = Mess;
/*sms.read collects one digit of the messages at time and stores it in the variable c.
This while loop builds a String variable "lastMess" from each byte in the messages for displaying.
*/
}Serial.println(lastMess); // prints the whole messages on the monitor and LCD screen
}//end for
sms.flush(); //discards the SMS message
}
but it isn't correct ! can you tell me the items i have to rectify ??