Hello,
I'm working on a shcool project that involves sending sms messages using a SIM900 gsm module (SIM900/SIM900A GSM/GPRS Minimum System Module - ITEAD Wiki) hooked up to an arduino mega adk. I have functioning code that uses AT commands. When ever I run the code, the serial monitor says that it worked (I get +CMGS: 87 OK), but my phone doesn't receive the sms. I have tested the sim card and it works (no PIN needed). The board is able to read the sim and can connect to the gsm network. Is there something I am missing or could there be something wrong with my board?
Here is my code and what is output by the serial monitor
#include <SoftwareSerial.h>
SoftwareSerial mySerial(50, 51);
void setup()
{
mySerial.begin(9600); // Setting the baud rate of GSM Module
Serial.begin(9600); // Setting the baud rate of Serial Monitor (Arduino)
delay(100);
SendMessage();
}
void loop()
{
if (mySerial.available())
Serial.write(mySerial.read());
}
void SendMessage()
{
mySerial.println("AT+CMGF=1""\r"); //Sets the GSM Module in Text Mode
delay(1000); // Delay of 1000 milli seconds or 1 second
mySerial.println("AT+CMGS="+1xxxxxxxxxx"\r"); // Replace x with mobile number
delay(1000);
mySerial.println("Alert!""\r");// The SMS text you want to send
delay(1000);
mySerial.println((char)26);// ASCII code of CTRL+Z
delay(1000);
}
Serial Monitor Output
AT+CMGF=1
OK
AT+CMGS="+1xxxxxxxxxx"
Alert!
+CMGS: 87
OK
Any Feedback would be appreciated.
Thanks
(Note: I replaced my phone number with x's)