sms.flush() not working.. ?... GSM Sheild problem.

Hello…

Working on a rather big project(for me at least), 100 problems, but just have to take 1 at a time,

I’m using the ReciveSMS example from librarys… with minor modifications.

First problem is that it only get “connection” some of the times… dont know why… but sometimes it works… and sometimes it dont… cant realy understand why… it’s just stuck at “SMS Messages Receiver”

i’ve sendt 3-4 sms’s to the sim, but when i hit start the arduino it just recives the first sms each time…

does not seem like it deletes any of the messages…

SMS Messages Receiver
GSM initialized
Waiting for messages
Message received from:
NetCom
Hei, for a sikre deg korrekt innstillinger for MMS- og mobilt In
END OF MESSAGE
MESSAGE DELETED

SMS Messages Receiver
GSM initialized
Waiting for messages
Message received from:
NetCom
Hei, for a sikre deg korrekt innstillinger for MMS- og mobilt In
END OF MESSAGE
MESSAGE DELETED

This is just the message from the mobile service provider… (brand new sim)
cant read the whole message, just first line it seems like…
but thats not a problem for me…
i just need to know how to delete the sms’s

// include the GSM library
#include <GSM.h>

// PIN Number for the SIM
#define PINNUMBER "9091"

// initialize the library instances
GSM gsmAccess;
GSM_SMS sms;

// Array to hold the number a SMS is retreived from
char senderNumber[20];

void setup()
{
  powerUp(); //power up gsm sheild
  // initialize serial communications and wait for port to open:
  Serial.begin(9600);
  while (!Serial) {
    ; // wait for serial port to connect. Needed for Leonardo only
  }

  Serial.println("SMS Messages Receiver");

  // connection state
  boolean notConnected = true;

  // Start GSM connection
  while (notConnected)
  {
    if (gsmAccess.begin(PINNUMBER) == GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }
  }

  Serial.println("GSM initialized");
  Serial.println("Waiting for messages");
}

void powerUp()
{
pinMode(7, OUTPUT);
digitalWrite(7,LOW);
delay(1000);
digitalWrite(7,HIGH);
delay(2000);
digitalWrite(7,LOW);
delay(3000);
}

void loop()
{
  char c;

  // If there are any SMSs available()
  if (sms.available())
  {
    Serial.println("Message received from:");

    // Get remote number
    sms.remoteNumber(senderNumber, 20);
    Serial.println(senderNumber);

    // An example of message disposal
    // Any messages starting with # should be discarded
    if (sms.peek() == '#')
    {
      Serial.println("Discarded SMS");
      sms.flush();
    }

    // Read message bytes and print them
    while (c = sms.read())
      Serial.print(c);

    Serial.println("\nEND OF MESSAGE");

    // Delete message from modem memory
    sms.flush();
    Serial.println("MESSAGE DELETED");
  }

  delay(1000);

}

anyone have a simple gsm send/recive sms code i could try?

When you use the orignal ReceiveSMS sketch, does it work fine?

(btw, I think your post is in the wrong place)