To actually set the sketch into motion, open up your serial monitor and send
any character. After a few moments, the monitor should respond with a
number of information tidbits about your shield:
The sketch will finish faster if you turn the module on before running it. Try
holding down the “BOOT” button until you see the “RSSI” blink steadily at
1Hz. It’s a good idea to play with the BOOT button until you have a good
idea of how it controls the module.
Using the Library: Initialization
This example introduces a handful of functions and code lines you’ll
become very familiar with as you use the library. To begin, make sure you
include the “SFE_MG2639_CellShield” library at the top of any sketch. The
library also makes use of the
SoftwareSerial
library, which you’ll need to
include as well.
// The MG2639 library uses the SoftwareSerial library, and
// requires it to be included first.
#include <SoftwareSerial.h>
// Include the SFE_MG2639_CellShield library to access
// the cellular functions.
#include <SFE_MG2639_CellShield.h>
To begin communication the cellular module, and perform some set up, call
the
cell.begin()
function. This initializing function will return with the
status of the module after exit – if it returns 1 the module is on,
communicating, and ready to go. If it returns 0 the module is not
communicating with the Arduino for some reason.
// Run cell.begin() to initialize communication with the
// module and set it up.
uint8_t status = cell.begin();
if (status <= 0)
{
// If begin() returns 0 or a negative number, the Arduino
// is unable to communicate with the shield. Make sure
// it's getting enough power. Try again making sure the
// MG2639 is booted up before running the sketch.
Serial.println("Unable to communicate with shield.");
while(1)
;
}
If your Arduino is not communicating with the module, try turning it on
manually (via the BOOT button) and running the sketch again. If that fails,
make sure you have enough power supplied to the shield – the RSSI LED
should be steadily blinking at 1Hz after turning on. If you’re still not having
any luck communicating with the module, get in touch with our tech support
team and give them as much information about your setup as possible.
Page 11 of 22