Pages: [1]   Go Down
Author Topic: Error in code sample  (Read 976 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 1
Posts: 41
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Code:
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

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 20
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Pages: [1]   Go Up
Jump to: