Voice Calls questions

Hello:

You need to use the Arduino to control the button. See here:

but use pin number 2.

Remember that the shield pins are connected to the Arduino pins except pins 2, 3 and 7.

You have to merge both sketches (button example and SMS example). This should run:

// libraries
#include <GSM.h>

#define PINNUMBER ""

// initialize the library instance
GSM gsmAccess; // include a 'true' parameter for debug enabled
GSM_SMS sms;

// constants won't change. They're used here to
// set pin numbers:
const int buttonPin = 6; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
int buttonState = 0; // variable for reading the pushbutton status

void setup()
{
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);

// initialize serial communications
Serial.begin(9600);

Serial.println("SMS Messages Sender");

// connection state
boolean notConnected = true;

// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY)
notConnected = false;
else
{
Serial.println("Not connected");
delay(1000);
}
}

Serial.println("GSM initialized");
}

void loop()
{

Serial.print("Enter a mobile number: ");
char remoteNumber[20]; // telephone number to send sms
readSerial(remoteNumber);
Serial.println(remoteNumber);

// sms text
Serial.print("Now, enter SMS content: ");
char txtMsg[200];
readSerial(txtMsg);
Serial.println("SENDING");
Serial.println();
Serial.println("Message:");
Serial.println(txtMsg);

// send the message
sms.beginSMS(remoteNumber);
sms.print(txtMsg);
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
}

/*
Read input serial
*/
int readSerial(char result[])
{
int i = 0;
while(1)
{
while (Serial.available() > 0)
{
char inChar = Serial.read();
if (inChar == '\n')
{
result = '\0';

  • Serial.flush();*
  • return 0;*
  • }*
  • if(inChar!='\r')*
  • {*
    _ result = inChar;_
    * i++;*
    * }*
    * }*
    * }*
    }