I recently purchased the GSM shield (Arduino Official Store | Boards Shields Kits Accessories) and am able to get the HTTP requests to work, however I am having issues with the SMS messaging. Below is my Debug output and also my code. I am sure it has something to do with the CMS ERROR message, but I have no idea what it means. Can anyone help with this?
Debug Message:
Sending message...
AT+CMGS="1-972-277-1763"%13%
49 53>%13%%10%>
Hello World!%26%%13%
49 73>%13%%10%> %13%%10%+CMS ERROR: 3518%13%%10%
Message sent
Code:
[tt]#include <GSM.h>
#include <GSM3CircularBuffer.h>
#include <GSM3MobileAccessProvider.h>
#include <GSM3MobileCellManagement.h>
#include <GSM3MobileClientProvider.h>
#include <GSM3MobileClientService.h>
#include <GSM3MobileDataNetworkProvider.h>
#include <GSM3MobileMockupProvider.h>
#include <GSM3MobileNetworkProvider.h>
#include <GSM3MobileNetworkRegistry.h>
#include <GSM3MobileServerProvider.h>
#include <GSM3MobileServerService.h>
#include <GSM3MobileSMSProvider.h>
#include <GSM3MobileVoiceProvider.h>
#include <GSM3ShieldV1.h>
#include <GSM3ShieldV1AccessProvider.h>
#include <GSM3ShieldV1BandManagement.h>
#include <GSM3ShieldV1BaseProvider.h>
#include <GSM3ShieldV1CellManagement.h>
#include <GSM3ShieldV1ClientProvider.h>
#include <GSM3ShieldV1DataNetworkProvider.h>
#include <GSM3ShieldV1DirectModemProvider.h>
#include <GSM3ShieldV1ModemCore.h>
#include <GSM3ShieldV1ModemVerification.h>
#include <GSM3ShieldV1MultiClientProvider.h>
#include <GSM3ShieldV1MultiServerProvider.h>
#include <GSM3ShieldV1PinManagement.h>
#include <GSM3ShieldV1ScanNetworks.h>
#include <GSM3ShieldV1ServerProvider.h>
#include <GSM3ShieldV1SMSProvider.h>
#include <GSM3ShieldV1VoiceProvider.h>
#include <GSM3SMSService.h>
#include <GSM3SoftSerial.h>
#include <GSM3VoiceCallService.h>
// PIN number if necessary
#define KEY "My Key"
#define PINNUMBER "The SIM's PIN"
// APN data
#define GPRS_APN "bluevia.movistar.es" // replace your GPRS APN
#define GPRS_LOGIN "" // replace with your GPRS login
#define GPRS_PASSWORD "" // replace with your GPRS password
// initialize the library instances
GSMClient client;
GPRS gprs;
GSM gsmAccess(true);// Pass this for debugging
GSM_SMS sms(true);
char server[] = "arduino.cc"; // the base URL
char path[] = "/"; // the path
int port = 80; // the port, 80 for HTTP
// char array of the telephone number to send SMS
// change the number 1-212-555-1212 to a number
// you have access to
char remoteNumber[20]= "1-000-000-0000";
// char array of the message
char txtMsg[200]="Test";
boolean messageSent = false;
void setup()
{
// initialize serial communications
Serial.begin(9600);
Serial.println("Starting Arduino setup");
// connection state
boolean notConnected = true;
// Start GSM shield
// pass the PIN of your SIM as a parameter of gsmAccess.begin()
while(notConnected)
{
if(gsmAccess.begin()==GSM_READY){
Serial.println("GSM is Ready");
notConnected = false;
if(gprs.attachGPRS(GPRS_APN, GPRS_LOGIN, GPRS_PASSWORD)==GPRS_READY){
Serial.println("GPRS is Ready");
notConnected = false;
delay(1000);
}
else{
Serial.println("GPRS is not ready");
delay(1000);
}
}
else
{
Serial.println("GSM is not ready");
delay(1000);
}
}
Serial.println("GSM and GPRS is initialized");
}
void loop() {
if(!messageSent){
Serial.println("Sending message...");
sms.beginSMS(remoteNumber);
sms.print("Hello World!");
sms.endSMS();
messageSent = true;
Serial.println("Message sent");
}
}
[/tt]