when i put code like this when i turn on my gsm shield PIR sensor is not working.
#include "SIM900.h"
#include <SoftwareSerial.h>
#include "sms.h"
#include "gsm.h"
#include "string.h"
#define DEBUG_CODE_ON
#define DEBUG_ACTION_ON
SMSGSM sms;
boolean started=false;
boolean startSMS=false;
char smsbuffer[8];
char n_in[8];
char pompe_on[] = "Pompeon";
char pompe_off[] = "Pompeoff";
int led=13;
int PIRSensor=2;
void setup()
{
// digit
pinMode(led, OUTPUT);
pinMode(PIRSensor, INPUT);
//Serial connection.
Serial.begin(9600);
Serial.println("GSM Shield testing.");
// GSM START
if (gsm.begin(9600))
{
Serial.println("\nstatus=READY");
started=true;
}
}
void loop()
{
if(started){
if(digitalRead(PIRSensor)==HIGH){ // read the input pin
digitalWrite(led, HIGH); // sets the LED to the button's value
delay(1000);
digitalWrite(led, LOW); // delay in milisecond. 3000 = 3 second
}
}
}
but when i put this code like this then if gsm shield is off PIR sensor is working but not working when gsm shield is on
void loop()
{
if(digitalRead(PIRSensor)==HIGH){ // read the input pin
digitalWrite(led, HIGH); // sets the LED to the button's value
delay(1000);
digitalWrite(led, LOW); // delay in milisecond. 3000 = 3 second
}
if(started){
}
}