XBee Cellular Smart Modem and Arduino

Hi! I am new to Arduino and I was wondering if anyone could help me figure what the problem with my code is/ what I should do instead!

I have an XBee Cellular Smart Modem attached to a sparkfun XBee shield, which is attached to my arduino uno. I am trying to write a code to send an sms to my phone, but whenever I run it I don't get any messages. I feel as if it is a problem with my usage of the AT commands, but I need some guidance on how to fix them.

I have my XBee on API mode 2. Here is my code:

#include <Printers.h>
#include <XBee.h>
#include <SoftwareSerial.h>

#define RX 11
#define TX 10

SoftwareSerial DigiCell(RX, TX);
void setup()
{
 Serial.begin(9600);
 DigiCell.begin(9600);
}
void loop()
{
 delay(1200);
 Serial.print("AT");
 delay(1200);
 bool bOK = false;
 while (Serial.available() > 0)
 {
   char inChar = (char)Serial.read();
   bOK = true;
 }

 if (bOK)
 {
   int index = 0;
   DigiCell.println();
   DigiCell.print("AT+CMGF=1"); 
   delay(1200);
   bool bOK = false;

   while (Serial.available() > 0)
   {
     //Serial.write(Serial.read());
     char inChar = (char)Serial.read();
     bOK = true;
   }

   if (bOK)
   {
     delay(5000);
     DigiCell.println();
     DigiCell.print("AT+CMGS= "); // send the SMS number
     DigiCell.print("xxxxxxxxx"); //where i enter my phone number
     DigiCell.println(" ");
     delay(5000);
     DigiCell.print("Success"); // SMS body
     delay(5000);

   }
 }
}

I have an XBee Cellular Smart Modem

Link?

attached to a sparkfun XBee shield

Link?

void loop()
{
 delay(1200);

Why are you stuffing your head in the sand first thing?

 Serial.print("AT");

What is the PC supposed to do with that?

 bool bOK = false;
 while (Serial.available() > 0)
 {
   char inChar = (char)Serial.read();
   bOK = true;
 }

Why do you care what the PC has to say?

   DigiCell.println();
   DigiCell.print("AT+CMGF=1");
   delay(1200);
   bool bOK = false;

   while (Serial.available() > 0)
   {

You talk to the modem, and expect a reply from the PC. How is that working for you?

Never mind, I already know the answer to that.

Sorry for not including links!

Here is the XBee

The XBee Cellular Smart Modem:

and the shield,

Sparkfun shield

The Serial.print("AT"); was meant to confirm that the communication was working in the serial monitor.

I changed the code to this:

#include <Printers.h>
#include <XBee.h>
#include <SoftwareSerial.h>

#define RX 11
#define TX 10


SoftwareSerial DigiCell(RX, TX);
void setup()
{
  Serial.begin(9600);
  DigiCell.begin(9600);
}
void loop()
{
  Serial.print("AT");
  delay(1200);
  bool bOK = false;
  while (DigiCell.available() > 0)
  {
    char inChar = (char)DigiCell.read();
    bOK = true;
  }

  if (bOK)
  {
    int index = 0;
    DigiCell.println();
    DigiCell.print("AT+CMGF=1"); 
    delay(1200);
    bool bOK = false;

    while (DigiCell.available() > 0)
    {
      //Serial.write(Serial.read());
      char inChar = (char)DigiCell.read();
      bOK = true;
    }

    if (bOK)
    {
      delay(5000);
      DigiCell.println();
      DigiCell.print("AT+CMGS= "); // send the SMS number
      DigiCell.print("xxxxxxxxxx");
      DigiCell.println(" ");
      delay(5000);
      DigiCell.print("success!"); // SMS body
      delay(5000);
   
    }
  }
}

I changed the code to this:

I don't understand why. If you post on the Arduino forum, do you then go to the MilkingCowsForFunAndProfit.com forum to read the reply?

If you use DigiCell to talk to the modem, you use DigiCell to read the reply. If you use Serial to talk to the PC, you use Serial to read the reply.

Sending the AT command to the PC, and expecting a reply from the modem is pointless.

In spite of the moderator's rudeness and lack of helpfulness, were you able to find any answers to your questions? I am working on the same type of project and would welcome your experiences.

Thanks.