Hello everybody,
I am trying to send an sms with my Arduino UNO and the GSM Shield with the following code:
// Include the GSM library
#include <GSM.h>
#define PINNUMBER "1234"
// initialize the library instance
GSM gsmAccess;
GSM_SMS sms;
boolean bo = true;
void setup() {
// initialize serial communications and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // wait for serial port to connect. Needed for native USB port only
}
Serial.println("SMS Messages Sender");
// connection state
boolean notConnected = true;
// Start GSM shield
// If your SIM has PIN, pass it as a parameter of begin() in quotes
while (notConnected) {
if (gsmAccess.begin(PINNUMBER) == GSM_READY) {
notConnected = false;
} else {
Serial.println("Not connected");
delay(1000);
}
}
Serial.println("GSM initialized");
}
void loop() {
if(bo == true)
{
Serial.println("in if");
char txtMsg[] = "test";
char remoteNum[] = "0123456789";
// send the message
sms.beginSMS(remoteNum);
Serial.println("beginSMS");
sms.print(txtMsg);
Serial.println("print SMS");
sms.endSMS();
Serial.println("\nCOMPLETE!\n");
Serial.println(" ende if");
bo = false;
}
}
Running the program, I do not receive any sms. The last output of the serial monitor is "print SMS". The example sketch "SendSMS" ran without problems.
Where could be the mistake?
ludwigm