Condition to make a call with sim900

i have used this programm and its working to make calls from arduino and sim900 to my mobile but i want to make a condition like push button or something to make this call and im not able to do that, Please help me if you have any idea .

#include <SoftwareSerial.h>

//Create software serial object to communicate with SIM900
SoftwareSerial mySerial(7, 8); //SIM900 Tx & Rx is connected to Arduino #7 & #8

void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);

//Begin serial communication with Arduino and SIM900
mySerial.begin(9600);

Serial.println(“Initializing…”);
delay(1000);

mySerial.println(“AT”); //Handshaking with SIM900
updateSerial();

mySerial.println(“ATD+ +ZZxxxxxxxxxx;”); // change ZZ with country code and xxxxxxxxxxx with phone number to dial
updateSerial();
delay(20000); // wait for 20 seconds…
mySerial.println(“ATH”); //hang up
updateSerial();
}

void loop()
{
}

void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}

This topic was automatically closed 120 days after the last reply. New replies are no longer allowed.