Apologies, thought it was about time I learnt some lessons so see attached revised code which is now formatted correctly via auto-format and revised two consecutive "if" statements to "if/else".
Problem remains though
// libraries
#include <GSM.h>
#include <Arduino.h>
#include <avr/wdt.h>
#define PINNUMBER ""
// initialize the library instance
GSM gsmAccess(true); // include a 'true' parameter for debug enabled
GSMVoiceCall vcs;
// Set the Constants
const int buttonPin = 4; // the number of the PUSHBUTTON PIN
const int readyPin = 13; // the number of the OK LED PIN
const int failPin = 12; // the number of the FAIL LED PIN
const int callPin = 11; // the number of the CALL LED PIN
// Set the variables
int buttonState = 0; // variable for reading the pushbutton status
// Timeout Variables
unsigned long startMillis;
unsigned long currentMillis;
const unsigned long period = 21600000; // reset every 6 hours once running
void reboot() {
analogWrite(7, 0);
delay (2000);
analogWrite(7, 255);
attemptplus();
}
void attemptplus() {
delay (10000);
if (gsmAccess.begin(PINNUMBER) == GSM_READY)
{ loop();
}
else
{
reboot();
}
}
void setup() {
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);
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
{
digitalWrite(failPin, HIGH); //Fail LED
delay (10000);
if (gsmAccess.begin(PINNUMBER) == GSM_READY)
loop();
else
reboot();
}
}
void loop() {
buttonState = digitalRead(buttonPin);
digitalWrite(failPin, LOW);
digitalWrite(readyPin, HIGH);
if ((buttonState == HIGH) & (vcs.getvoiceCallStatus() != TALKING))
{
digitalWrite(callPin, HIGH);
vcs.voiceCall("07432297183");
}
if (vcs.getvoiceCallStatus() == TALKING)
{
digitalWrite(callPin, HIGH);
}
else
{
digitalWrite(callPin, LOW);
}
}