Here is my complete code so far.
This leads to the Arduino constantly rebooting...
My first action is to bring pin 8 HIGH so as to not prompt a reset as this pin is connected to the reset pin on the board. This therefore should not be the cause. I have looked at the instructions on forum for using millis and have tried to replicate as best I could bearing in mind that I am trying to get this in the setup loop and not the main body.
Hopefully somebody can see a syntax error somewhere perhaps that is causing the board to jump to reboot continuously.
Many thanks for all help received thus far.
// libraries
#include <GSM.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
const int testPin = 8; // the number of the TEST 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 = 15000;
void setup() {
digitalWrite(testPin, HIGH);
// Start Timeout Timer
startMillis = millis();
// initialize the LED pins as an output
pinMode(readyPin, OUTPUT);
pinMode(failPin, OUTPUT);
pinMode(callPin, OUTPUT);
pinMode(testPin, 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);
currentMillis = millis();}
if (currentMillis - startMillis >= period);
{digitalWrite(testPin, LOW);}
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
{ notConnected = false;
digitalWrite(failPin, LOW);
digitalWrite(readyPin, HIGH);}
}}
void loop() {
// put your main code here, to run repeatedly
buttonState = digitalRead(buttonPin);
if ((buttonState == HIGH)&(vcs.getvoiceCallStatus()!=TALKING))
{
digitalWrite(callPin, HIGH);
vcs.voiceCall("07432297183");
}
if (vcs.getvoiceCallStatus()==TALKING)
{
digitalWrite(callPin, HIGH);
}
else
{
digitalWrite(callPin, LOW);
} }