A6 not running automatically

Dear all

I have update the code for using the A6 a (very) little.
It should send an sms as soon as a counter reaches 20.

It works when I upload the programme via the Arduino app.

However, if I just connect my arduino to a power source, it doesn't send the sms.

Other programs I did wrote in the past, worked fine and started to work as soon as it was uploaded and connected to an external power source.

I have not the faintest idea why this is not working. Does it has something to do with the serial monitor - which is absent if the Arduino works 'not-connected' to a computer?

Regards
Diederik

void setup()
{
//Begin serial communication with Arduino and Arduino IDE (Serial Monitor)
Serial.begin(9600);

}

void updateSerial()
{
delay(500);
while (Serial.available())
{
mySerial.write(Serial.read());//Forward what Serial received to Software Serial Port
}
while(mySerial.available())
{
Serial.write(mySerial.read());//Forward what Software Serial received to Serial Port
}
}

void loop()
{
delay(1000);
teller++;
Serial.println(teller);
if (teller==20) { //Begin serial communication with Arduino and A6
mySerial.begin(9600);

Serial.println("Initializing...");
delay(1000);

mySerial.println("AT"); //Once the handshake test is successful, it will back to OK
updateSerial();

mySerial.println("AT+CMGF=1"); // Configuring TEXT mode
updateSerial();
mySerial.println("AT+CMGS="0497249119"");//change ZZ with country code and xxxxxxxxxxx with phone number to sms
updateSerial();
mySerial.print("teller 20"); //text content
updateSerial();
mySerial.write(26);}

}

How are you powering the Arduino board? What voltage? Is it connected to the USB socket on the board, the barrel jack, etc.?

How are you powering the A6? Is it connected to the power source directly, or to one of the pins on the Arduino board? If the latter, which pin?

I tried connecting it via USB and with an external 12V adapter.
The A6 is powered via the Arduino.

It works when connected via USB with Arduino app open and program uploaded.

If I close the app, disconnect the USB and reconnect it, I don't receive the sms.

Regards
Diederik