Вот собственно скетч :
 
 
	PHP код:
	
 char inchar;                //Will hold the incoming character from the Serial Port.
  int led1 = 5;
  
  
  void setup()
  {
    // prepare the digital output pins
    pinMode(led1, OUTPUT);
   
    digitalWrite(led1, LOW);
    
    //Initialize GSM module serial port for communication.
    Serial.begin(9600); //  for GSM module communication
    delay(30000); // 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,0,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=='#')
      {
        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);
          
              }
            }
            Serial.println("AT+CMGD=1,4"); // delete all SMS
          }
        
    } 
 Строку Serial.println("AT+CNMI=3,0,0,0"); // set module to send SMS data to serial out upon receipt я поменял. Было значение 3,3,0,0 , но тогда текст сообщения не открывался.
С использованием Serial1 (вместо Serial) в терминале все работает, но на Ардуину не передается, т.к. даже СМС не удаляется, т.е. работает не ардуина, а терминал (как ємулятор).
При использовании Serial, не работает вообще. 
Пробовал подключить NewSoftSerial, результата тоже нет...