system
March 18, 2014, 1:54pm
1
The problem is when there isn't any signal
gsmAccess.begin(PINNUMBER)
dosn't return anything and, the program stops, which isn't disired.
Can I some how getting it to return somthing, Then I can handle no signal, and make the next code execute?
Best regards nikolaj
Seeing your whole program and a link the the hardware and libraries that you are using would be helpful.........
system
March 18, 2014, 2:28pm
3
The time between status, at the return of the status is the problem. And i the signal i 0-1 then gsmAccess.begin(PINNUMBER) dosn't return anything, and the program stops, which is not desireable.
Hardware:
Arduino Uno http://arduino.cc/en/Main/ArduinoBoardUno#.UyhZPoU6Wo8
GSM shield (External antenna) http://arduino.cc/en/Main/ArduinoGSMShield#.UyhZeIU6Wo8
Code
// import the GSM library
#include <GSM.h>
// PIN Number
#define PINNUMBER "1233"
// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSMScanner scannerNetworks;
void setup()
{
// initialize serial communications
Serial.begin(9600);
//scannerNetworks.begin ();
}
void loop(){
Serial.print("status: ");
switch (gsmAccess.begin(PINNUMBER)) {
case 0:
Serial.print("Synkroniserer ikke \n");
break;
case IDLE:
Serial.println("IDLE \n");
delay(1000);
break;
case CONNECTING:
Serial.println("CONNECTING \n");
delay(1000);
break;
case GSM_READY:
Serial.println("GSM_READY \n");
delay(1000);
break;
case GPRS_READY:
Serial.println("GPRS_READY \n");
delay(1000);
break;
case TRANSPARENT_CONNECTED :
Serial.println("TRANSPARENT_CONNECTED \n");
delay(1000);
break;
default:
Serial.println("ERROR eller udefineret \n");
delay(1000);
break;
}
Serial.print("Signal styrke: ");
Serial.print(scannerNetworks.getSignalStrength());
Serial.print("\n-----------------\n");
}