Hi,
I bought the Arduino GSM Shield 2 and I am trying to send an SMS.
I am using:
- Arduino Mega ( I did the necessary changes for Mega)
- standard GSM library ( 1.0.6)
- sim card (in Austria) which has been checked with a phone
What the program does:
- connect to gsm and turn on a led when connected ( this part is working)
- send an SMS when I push a button ( this part does not work)
The code is pretty close to the samples provided by arduino web site.
#include <GSM.h>
#define PINNUMBER "XXXX"
const int buttonPin = 4;
const int ledPin = 12;
const int ledPinBoard = 13;
int buttonState = 0;
GSM gsmAccess(true);
GSM_SMS sms;
boolean notConnected = true;
boolean doSend = false;
char remoteNumber[20]= "XXXXXXXXXX";
void setup() {
Serial.begin(9600);
pinMode(ledPin, OUTPUT);
pinMode(ledPinBoard, OUTPUT);
pinMode(buttonPin, INPUT);
digitalWrite(ledPinBoard, LOW);
}
void loop() {
buttonState = digitalRead(buttonPin);
if (buttonState == HIGH) {
doSend = true;
}
if(notConnected)
{
if(gsmAccess.begin(PINNUMBER)==GSM_READY) {
notConnected = false;
Serial.println("Connected");
digitalWrite(ledPin, HIGH);
} else {
digitalWrite(ledPin, LOW);
}
} else {
digitalWrite(ledPin, HIGH);
}
if (doSend) {
doSend=false;
sendSMS();
}
delay(1000);
}
void sendSMS(){
char txtMsg[200]="Test";
sms.beginSMS(remoteNumber);
sms.print(txtMsg);
sms.endSMS();
}
Th Error which I get after sms.endSMS(); is :
AT+CMGS="XXXXXXXXXX"%13%
58 62>%13%%10%>
Test%26%%13%
58 81>%13%%10%> %13%%10%+CMS ERROR: 159%13%%10%
Error 159 means "Unspecified TP-DCS error" but that is pretty much all that I found about it ( the name).
Am I missing something ?
Is there maybe a workaround for it ?
Thanks !