Sign up ×
Arduino Stack Exchange is a question and answer site for developers of open-source hardware and software that is compatible with Arduino. It's 100% free, no registration required.

I have an Arduino and bought a SIM900 module.

I looked at the tutorial at the Arduino website and I worked out the following code:

#include <GSM.h>

#include <VirtualWire.h>    

#define PINNUMBER      "xxxx" //4 real numbers -> censored ;-)
#define GPRS_APN       "pinternet.interkom.de" 
#define GPRS_LOGIN     "" //not necessary
#define GPRS_PASSWORD  "" //not necessary

GSMClient client;
GPRS gprs;
GSM gsmAccess;

char server[] = "a.real.ip.accessable"; 
char path[] = "/api/devices/";
int port = 80;

void setup()
{
  Serial.begin(9600);

  boolean notConnected = true;
  Serial.println("trying to connect");
  while(notConnected)
  {
    if((gsmAccess.begin(PINNUMBER)==GSM_READY) &
        (gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY)){
      notConnected = false;
      Serial.println("connected");
    }else{
      Serial.println("Not connected");
      delay(1000);
    }
  }
  Serial.println("finished Setup");
}

I get the first message trying to connect. But I don't get not connected or connected. So it gets stuck inside the while loop. I don't know why. Shouldn't it print a message in each loop?

share|improve this question

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Browse other questions tagged or ask your own question.