sparkfun MG2639 Cellular Shield Hook-Up Manual page 20

Table of Contents

Advertisement

Answering, Rejecting, and Hanging Up
If a call is coming in –
phone.status()
can use
to pick it up.
phone.answer()
If you've checked the caller ID and don't really feel like talking to the
individual paired with that number, you have two options: ignore the call
until they hang up or run
phone.hangUp()
Likewise, if you've answered the call and want to end it, call
to close the line.
phone.hangUp()
Dialing
If you want to initiate a phone call, use
to start dialing.
should be a character array formatted like any
phoneNumber
phone number you would dial from a normal phone. If you're in the same
area code, it may be as few as 7 digits (assuming it's a U.S. number). On
the other end of the spectrum, with international codes included, the
number can be as long as 15 digits.
Here's a quick example:
char destinationPhone[] = "13032840979"; // SparkFun HQ ­ 1­30
3­284­0979
phone.dial(destinationPhone); // Dial the phone number
Serial.println("Dialing");
do
int phoneStatus = phone.status();
    Serial.print(".");
} while ((phoneStatus != CALL_ACTIVE) || (phoneStatus != CALL_
IDLE)) 
if (callStatus == CALL_ACTIVE)
    Serial.println("Other end picked up!");
Again, you can use
phone.hangUp()
does so first.
Example Bonus: Posting to Phant
The motivating factor behind us seeking out a solid cellular module was
finding a reliable tool to remotely post environment data to our data service
running Phant. We'd be remiss if we didn't show at least one example of
how to use the hardware and IoT service together.
Download the Phant Library
A sketch included with the library – MG2639_Phant – requires an additional
library to take care of Phant posts. Download the library from our Phant-
Arduino repo, or by clicking the button below:
D O W N LO A D T H E P H AN T A R D UI N O L I B RA R Y
Again, follow the Installing an Arduino Library tutorial for help installing it.
If you already have the Phant Arduino library, make sure it's updated
to the latest version -- this sketch takes advantage of some flash-string
storage recently added to the library. Memory is at a real premium.
You'll get a compile error if the library isn't updated.
Running the Example
Open the MG2639_Phant example sketch by going to File > Examples >
SparkFun MG2639 CellShield > MG2639_Phant.
is returning
– you
CALL_INCOMING
to reject the call.
phone.dial(char * phoneNumber)
to end the call, unless the other party
Page 20 of 22

Advertisement

Table of Contents
loading
Need help?

Need help?

Do you have a question about the MG2639 Cellular Shield and is the answer not in the manual?

Questions and answers

Subscribe to Our Youtube Channel

Table of Contents