void loop(){
// read the pushbutton input pin:
buttonState = digitalRead(buttonPin);
if (buttonState = HIGH) {
digitalWrite(ledPin, HIGH);
} else {
// if the current state is LOW then the button went from on to off:
digitalWrite(ledPin, LOW);
}
// Delay a little bit to avoid bouncing
delay(50);
if (vcs.voiceCall("07432297183"))
{
Serial.println("Call Established. Enter line to end");
// Wait for some input from the line
while(Serial.read()!='\n' && (vcs.getvoiceCallStatus()==TALKING));
// And hang up
vcs.hangCall();
}
Serial.println("Call Finished");
}
As you can see, I have now removed the duplicate IF statements so only one remains.
In terms of how the switch is configured it is as per the attached diagram, using a 10k Ohm resistor.
What this now results in is as soon as I get "GSM Initialized" message the Arduino dials out without the button being pressed.
