Thanks for the tip on formatting posted code - edit done. (Sorry, I'm a newbie).
I tried the begin() method with the synchronous parameter set to false (default is true). I called this multiple times - it just returned 0 until I got bored.
I did try adding the debug parameter - as in GSM gsm(true) - I also tried to see what was being returned:
My current code:
#include <GSM.h>
//#include <SoftwareSerial.h> // this library conflicts with GSM.h and generates a compiler error
//SoftwareSerial SIM900(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8 - see above - so can't set this up
#define PINNUMBER "" // I am convinced my SIM is unlocked as I can send SMS messages with it if I just use SoftwareSerial.h and use AT commands
// initialize the library instance
GSM gsmAccess(true); // include a 'true' parameter for debug enabled
GSM_SMS sms;
// char array of the telephone number to send SMS
// change the number 1-212-555-1212 to a number
// you have access to
char remoteNumber[20]= "+44[*my mobile here*]";
// char array of the message
char txtMsg[200]="Test";
void setup(){
// initialize serial communications
Serial.begin(9600);
Serial.println("SMS Messages Sender");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected) {
if(gsmAccess.begin("",true,false)==GSM_READY){
//if(gsmAccess.begin()==GSM_READY) {
Serial.println("A");
notConnected = false;
}
else {
Serial.println("Not connected");
Serial.println(gsmAccess.begin("",true,false));
delay(1000);
}
}
Serial.println("GSM initialized");
sendSMS();
}
void loop()
{
// nothing to see here
}
void sendSMS(){
Serial.print("Message to mobile number: ");
Serial.println(remoteNumber);
// sms text
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);
// send the message - OK just don't not yet
//sms.beginSMS(remoteNumber);
//sms.print(txtMsg);
//sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}
This is what serial output yields:
SMS Messages Sender
AT%13%Not connected
AT%13%2
AT%13%Not connected
AT%13%2
AT%13%Not connected
So the gsmAccessBegin is returning "2". Not sure really what this means. Is this progress?
I'll have a bash at inserting some debug lines in the library source code but loath to do this (many better men have trod here before).