Hi all. I'm using an Arduino Duemilanove board with a GPRS shield and an Xbee shield. The thing is I want to send an SMS using the microcontroller, so I put the pins in Arduino mode as this picture says:
http://www.libelium.com/squidbee/index.php?title=Image:Gprs_hilo_1.jpg . And this is the program I used:
//Librería necesaria para comunicar con Xbee
//#include <SoftwareSerial.h>
//Los pines del "nuevo" puerto serie
#define rxPin 9
#define txPin 8
//Creamos un nuevo puerto serie
//SoftwareSerial xbee = SoftwareSerial(rxPin, txPin);
int led = 13;
//El pin que va a encender el módulo sin presionar el botón
int onModulePin = 2;
//Número de mensajes SMS a enviar
int timesToSend = 1;
int count = 0;
int inData = 0;
int inData1 = 0;
int inData2 = 0;
int inData3 = 0;
int inData4 = 0;
int inData5 = 0;
void switchModule()
{
digitalWrite(onModulePin, HIGH);
delay(2000);
digitalWrite(onModulePin, LOW);
}
void sendAlarmSMS()
{
Serial.print("AT+CMGS="); //Comando de envío de SMS
Serial.println(""*********""); //Número de móvil a enviar el SMS
delay(1500);
Serial.println("Prueba de SMS"); //Cuerpo del mensaje
delay(1500);
Serial.println(26,BYTE); //Enviamos el comando 1A (hex)
}
void setup()
{
pinMode(led, OUTPUT);
pinMode(onModulePin, OUTPUT);
pinMode(rxPin, INPUT);
pinMode(txPin, OUTPUT);
Serial.begin(115200); //El puerto GPRS
// xbee.begin(9600); //Establezco el rango de datos para el puerto SoftwareSerial
//switchModule();
delay(1000);
Serial.println("AT+CMGF=1"); //Establezco el modo de SMS a texto
delay(2500);
// xbee.println("SquidBee alarm mote ready");
//delay(500);
}
void loop()
{
if (count == 0)
{
sendAlarmSMS();
count += 1;
}
}
As you can notice in the source, I also connected an Xbee shield using this schematics:
I use the Serial port to communicate with my GPRS and the digital data to "speak" with my Xbee shield. By now I'm only trying to send that SMS and be sure that my GPRS module works fine with the Arduino programming. I used an hyperterminal to test it without the microcontroller, and I can correctly send SMS via AT commands (I previously changed the mode to USB so I can send SMS using a COM port). But when I try to send the text message programatically, I get the following error:
avrdude: stk500_getsync(): not in sync: resp=0Xec
avrdude: stk500_disable(): protocol error, expect 0x14, resp=0xec
And I receive an empty text message on my phone... ![]()
What I'm doing wrong?
Thank you for your help!