Help GPRS shield makes PIR Sensor always high

I am trying to use a SeeedStudioV1.4 GPRS shield along with a PIR sensor. The else triggered when the value goes low is stuck on high. Any help would be greatly appreciated. The shield works by itself and the sensor works by itself.

//1. Includes for Sheild
#include <GPRS_Shield_Arduino.h>
#include <SoftwareSerial.h>
#include <Wire.h>

//3.Sensor vars
int ledPin = 5; // choose the pin for the LED
int inputPin = 3; // choose the input pin (for PIR sensor)
int pirState = LOW; // we start, assuming no motion detected
int val = 0; // variable for reading the pin status

//2.shield vars
#define PIN_TX 7
#define PIN_RX 8
#define BAUDRATE 9600
#define PHONE_NUMBER “077********”
#define MESSAGE “Alert”


void setup() {


//4.setup and test
pinMode(ledPin, OUTPUT); // declare LED as output
pinMode(inputPin, INPUT); // declare sensor as input

while(!gprs.init()) {
Serial.println(“Initialization failed!”);

Serial.println(“Network has not registered yet!”);

void loop() {
val = digitalRead(inputPin); // read input value
if (val == HIGH) { // check if the input is HIGH
if (gprs.sendSMS(PHONE_NUMBER, MESSAGE)) //define phone number and text
Serial.print(“Send SMS Succeed!\r\n”);
digitalWrite(ledPin, HIGH); // turn LED ON

else {
digitalWrite(ledPin, LOW); // turn LED OFF

SimSec-V1.094.ino (1.36 KB)

int inputPin = 3;               // choose the input pin (for PIR sensor)

If you named the variable sensibly, the comment would not be necessary.

Without links to the hardware you are using, all we can offer is insincere sympathy.

Thanks for the advice on naming variables PaulS - I'll make them more descriptive in future.
I have also added links to the original post at the top but here are the links again for convenience:

The shield doesn't appear to be interfering with the pin that the PIR is connected to. So, the next thing I'd try is a sketch that does not include the GPRS library, and does not try to do anything with the shield. Does the PIR work properly, then?

Does it work properly without the shield in place?

Yes, the shield sends texts as expected and the PIR sensor works as expected. I imagine the problem is in my combination of these 2 example sketches.

the PIR sensor works as expected.

With the GPRS shield in place?