Hi, I am new to Arduinos as well and was having difficulties in this area. I don't know if this message will help you or not but I did want to offer this to you. I am using an Arduino Uno with a GPRS shield but this still may work for you. On the GPRS shield the default jumper settings for Rx and Tx is 7 & 8 and I had to leave it on those to get this to work. Then what ultimately ended up helping me was searching for code for the particular version of GPRS shield that I am using, in this case it is a version 1.4 board. Here is code that I am using and it does work for me. I haven't gone through the entire sketch yet to omit un-needed code. Hope this works for you
#include <SoftwareSerial.h>
SoftwareSerial GPRS(7, 8); // Tx and Rx pins 7 & 8
const int sensorPin = 12; // software sensor pin set to 12
boolean flooded = false;
boolean messageSent = false;
String TextMessage = ("ATTENTION Sump Pump Guardian Water Sensors Activated");
void setup()
{
GPRS.begin(19200);
Serial.begin(19200);
pinMode(sensorPin, INPUT); // set software pin 12 as an input
digitalWrite(sensorPin,LOW); // initialize water sensor pin low or false
delay(2000);
if (GPRS.available()>0)
{
toSerial();
}
else
{
powerUpOrDown(); //powers up the GPRS shield if powered off
delay(2000);
}
GPRS.println("AT+SAPBR=3,1,"CONTYPE","GPRS"");
delay(1000);
toSerial();
//Setup Cell company APN - Replace "epc.tmobile.com" with APN of your cell phone company
GPRS.println("AT+SAPBR=3,1,"APN","epc.tmobile.com"");
delay(4000);
toSerial();
// bearer settings
GPRS.println("AT+SAPBR=1,1");
delay(2000);
toSerial();
}
void loop()
{
if (digitalRead(sensorPin) == HIGH) //water sensor activated
{
flooded = true;
}
else if (digitalRead(sensorPin) == LOW) //water sensor not active
{
flooded = false;
messageSent = false;
}
if ((messageSent == false) && (flooded == false)) //set flooded == true for testing else set false for production. I know this
//sounds backwards, not sure why but maybe the library logic is incorrect
{
// send 1st text message to 1st cell phone
GPRS.println("AT+CMGF=1");
delay(100);
// put your phone number in here with format (area code)phone number
GPRS.println("AT+CMGS= "xxxxxxxxxx"");
delay(100);
GPRS.println(TextMessage);
delay(100);
GPRS.println((char)26); //tells sim900 to send text
delay(100);
toSerial();
delay(15000);
}
}
// FUNCTIONS
void toSerial()
{
while(GPRS.available()!=0)
{
Serial.write(GPRS.read());
}
}
void powerUpOrDown() //Power off or on GPRS Shield
{
pinMode(9, OUTPUT);
digitalWrite(9,LOW);
delay(1000);
digitalWrite(9,HIGH);
delay(2000);
digitalWrite(9,LOW);
delay(3000);
}