# GSM Shield - problem with sending sms

**URL:** <https://forum.arduino.cc/t/gsm-shield-problem-with-sending-sms/406064>\
**Category:** General Guidance\
**Created:** [September 3, 2016, 8:08pm UTC](https://forum.arduino.cc/t/gsm-shield-problem-with-sending-sms/406064 "2016-09-03T20:08:12Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![ludwigm](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@ludwigm](https://forum.arduino.cc/u/ludwigm)\
**Post date:** [September 3, 2016, 8:08pm UTC](https://forum.arduino.cc/t/gsm-shield-problem-with-sending-sms/406064/1 "2016-09-03T20:08:12Z")

</div>

Hello everybody,  
I am trying to send an sms with my Arduino UNO and the GSM Shield with the following code:

```cpp
// 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

---

<div class="post-metadata">

**Author:** ![ludwigm](https://avatars.discourse-cdn.com/v4/letter/l/f08c70/32.png) [@ludwigm](https://forum.arduino.cc/u/ludwigm)\
**Post date:** [September 8, 2016, 6:45pm UTC](https://forum.arduino.cc/t/gsm-shield-problem-with-sending-sms/406064/2 "2016-09-08T18:45:05Z")

</div>

Hello,  
I also tried this code, but it did not work, also.

```cpp
  // send the message
    sms.beginSMS("0123456789");
    sms.print("Hello World");
    sms.endSMS();
    Serial.println("\nCOMPLETE!\);

```

Does anybody have an idea?

---

<div class="post-metadata">

**Author:** ![system](https://dub1.discourse-cdn.com/arduino/user_avatar/forum.arduino.cc/system/32/1140315_2.png) [@system](https://forum.arduino.cc/u/system)\
**Post date:** [May 5, 2021, 5:57pm UTC](https://forum.arduino.cc/t/gsm-shield-problem-with-sending-sms/406064/3 "2021-05-05T17:57:45Z")

</div>


