Go Down

Topic: Error in code sample (Read 997 times) previous topic - next topic

joker

Code: [Select]
In [url]http://goo.gl/dj5gY[/url]

The suggested code for starting the GSM looks like:

[code]  // Start GSM shield
  // If your SIM has PIN, pass it as a parameter of begin() in quotes
  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER)==GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }


The error lies in the use of the begin() function. Under the above conditions, gsmAccess.begin(PINNUMBER) is solely required. For asynchronous operation, use:

  while(notConnected)
  {
    if(gsmAccess.begin(PINNUMBER, true, false)== GSM_READY)
      notConnected = false;
    else
    {
      Serial.println("Not connected");
      delay(1000);
    }[/code]

And add timeout checking according to your taste
HTH


zorzano

The examples are given in synchronous form. You only leave begin() after all the AT commands are executed and answered. In this form if begin() finds a problem returns. The loop tries to connect again.

The code you give is asynchronous as you said, so you will check the status also between AT commands. Please tell us how the library behaves asynchronously.

Go Up