azhurz / gsm-shield-arduino

Automatically exported from code.google.com/p/gsm-shield-arduino
0 stars 0 forks source link

sms.DeleteSMS((int)pos); didn't work as well #100

Open GoogleCodeExporter opened 8 years ago

GoogleCodeExporter commented 8 years ago
for a home domotic application, i use arduino uno + SIM900 GSM module.
in my loop, i check incoming SMS then run a high/low pin state to drive relay 
or whatever...

after some incomming SMS from my mobile phone, the code didn't work anymore, 
because my sim card is full of SMS.
(i need to put back my sim card into my cell phone and delete the sms)

sms.DeleteSMS((int)pos); didn't work as well

void driverly()
{
 pos=sms.IsSMSPresent(SMS_UNREAD);
  Serial.println((int)pos);
  if((int)pos>0&&(int)pos<=20){
    Serial.print("SMS incomming, POS=");
    Serial.println((int)pos);
    message[0]='\0';
    sms.GetSMS((int)pos,number,message,180);
    p=strstr(message,"password");
    if(p){
      Serial.println("PSWD OK");
      p=strstr(message,"led on");
      if(p){
        Serial.println("LED ON");
        digitalWrite(12,HIGH);
      }
      else{
        p=strstr(message,"led off");
        if(p){
          Serial.println("LED OFF");
          digitalWrite(12,LOW);
        }
       sms.DeleteSMS((int)pos);
      }
    }
 }
  delay(5000);
}

Original issue reported on code.google.com by j3tstr...@gmail.com on 13 Feb 2014 at 10:58