Using GSM Shield V3 with attachInterrupt

I need some help, hastily. I’m trying to trigger the GSM to send a text message when an ‘interrupt’ happens. All is well except it did not send the text message. Have I got it wrong somewhere? I made this out of combining button, interrupt and gsm basic codes.

#include <SoftwareSerial.h>
#include <String.h>

SoftwareSerial gprsSerial(7, 8);
const int buttonPin = 3; // the number of the pushbutton pin
const int ledPin = 13; // the number of the LED pin

// variables will change:
volatile int buttonState = 0; // variable for reading the pushbutton status

void setup() {
gprsSerial.begin(19200);
Serial.begin(19200);
delay(500);
// initialize the LED pin as an output:
pinMode(ledPin, OUTPUT);
// initialize the pushbutton pin as an input:
pinMode(buttonPin, INPUT);
// Attach an interrupt to the ISR vector
attachInterrupt(0, pin_ISR, CHANGE);
}

void loop() {
gprsSerial.println();
if(buttonState==1)
{
Serial.println(“Supply ON”);
delay(100);
}
else
{
Serial.println(“Supply OFF”);
delay(100);
}
delay(5000);
}

void pin_ISR() {
buttonState = digitalRead(buttonPin);
digitalWrite(ledPin, buttonState);
SendTextMessage();
}

void SendTextMessage()
{
Serial.println(“Sending Text…”);
gprsSerial.println(“AT+CMGF=1\r”);
delay(100);

gprsSerial.println(“AT+CMGS = “+???””);
delay(100);

if(buttonState==1)
{
gprsSerial.println(“Supply ON”);
delay(100);
gprsSerial.print((char)26);
delay(100);
}
else
{
gprsSerial.println(“Supply OFF”);
delay(100);
gprsSerial.print((char)26);
delay(100);
}
gprsSerial.println();
Serial.println(“Text Sent”);
}

Sorry, somehow it became a smiley. At SoftwareSerialgprsSerial(7,8)

Read the post at the top of the page "How to use this forum - please read". It will tell you how to post your code so that the smilies don't appear.

Which GSM shield V3 are we talking about?

oh my mistakes, GPRS Shield V3.0. It uses ‘screen’-like thingy for antenna. Supposedly I was using pin 2 for interrupt then I thought of pin 3. Serial monitor pops ok but the text message wasn’t sent.

https://www.seeedstudio.com/GPRS-Shield-V3.0-p-2333.html

exactly like this one.

Try running GPS serial at 9600. I would also consider investing in a better antenna!

I'm don't think the antenna is the problem because it works fine with other codes. Unless, the power supply is not enough then I guess that is where my problem is. But still, if it could function using other codes while plugged in with a USB, it should work with just this small code. I'm wondering if I got the interrupt function right. Interrupt cannot return values, as I read, but it should work for just running the SendTextMessage function right?

Create a volatile global variable, e.g. a bool. Set it in the ISR, read it in loop(). If you detect in loop() that it's set, send text and clear the flag.