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);
}
}
}
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.