and i need a simple script that can make phone calls and receve them
the number that should be dailed (on press of a button) must be stored as a variable
and when called you must keep a button pressed to talk (if you let go of the button it should hang up)
i have tryed to use the page for instructions but it onley talks about there serial monitor and i dont want to use that
and there is no mention of receving calls
i have rewritten the code of some guy here on the forums
#include <SoftwareSerial.h>
char inchar; // Will hold incoming character from the Serial Port
SoftwareSerial GPRS(7,8);
// unsigned char buffer[64]; // buffer array for data receive over serial port
int count=0; // counter for buffer array
int WTA = 13; //led
int numring=0;
int comring=1;
void setup()
{
GPRS.begin(19200); // the GPRS baud rate
Serial.begin(19200); // the Serial port of Arduino baud rate.
pinMode(9, OUTPUT); // Power up SIM900 GPRS
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(1000);
pinMode(WTA, OUTPUT); // Defines pin 10 as a +5V Digital Output
digitalWrite(WTA, LOW); //Sets WT trigger back low
delay(1000);
}
void TriggerWTA()
{
// pinMode(WTA, OUTPUT); // Defines pin 10 as a +5V Digital Output
GPRS.println("ATA"); //picks up when the led goes high
digitalWrite(WTA, HIGH); // Sets WT trigger HIGH
delay(5000);
digitalWrite(WTA, LOW); //Sets WT trigger back low
GPRS.println("ATH"); //hangs up when led goes low
}
void loop()
{
if(GPRS.available() >0) //If a character comes in from the cellular module...
{
inchar=GPRS.read();
if (inchar=='R')
{
delay(10);
inchar=GPRS.read();
if (inchar=='I')
{
delay(10);
inchar=GPRS.read();
if (inchar=='N')
{
delay(10);
inchar=GPRS.read();
if (inchar=='G')
{
delay(10);
numring++; // So the phone (our GSM shield) has 'rung' once, i.e. if it were a real phone it would have sounded 'ring-ring'
if (numring==comring)
{
numring=0; // reset ring counter
TriggerWTA();
}
}
}
}
}
}
}