Just to confirm this is now the code I have. I have taken out the initial IF statement which led to testPin going low. This is because testPin was linked to the reset pin but now that I have chosen to follow your advice on that then it is no longer required.
Result of the code below now is the ledFail flashed each and every second and the GSM shield also resets each second and so it is in a constant loop and cant establish a connection.
I have a feeling that the "if (gsmAccess.begin(PINNUMBER) == GSM_READY)" command may be rebooting the gsm shield, is that possible???
void setup() {
wdt_disable(); //v2
delay(2L * 1000L); //v2
wdt_enable(WDTO_2S); //v2
startMillis = millis();
// initialize the LED pins as an output
pinMode(readyPin, OUTPUT);
pinMode(failPin, OUTPUT);
pinMode(callPin, OUTPUT);
// initialize the pushbutton pin as an input
pinMode(buttonPin, INPUT);
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (notConnected == true) {
digitalWrite(failPin, HIGH);
if (gsmAccess.begin(PINNUMBER) == GSM_READY)
{ notConnected = false;
digitalWrite(failPin, LOW);
digitalWrite(readyPin, HIGH);
}
currentMillis = millis();
static unsigned long lastResetAtMs = 0 ;
if ( currentMillis - lastResetAtMs > 1000 ) { // v2
wdt_reset(); // v2 - reset wdt every 1 second until startupPeriod expires
lastResetAtMs += 1000 ; // v2
}
}
wdt_disable(); //v2
}