9V battery is putting out 6.8V.
How is your code different?
Your battery is dead.
--------------------
Here is my code
--------------------
int ledpin = 13; //Set the digital 13 to LED
int buzzPin = 6; // buzzer pin for pwm output
int PIRpin = 2; //Set the digital 2 to PIR
void setup() {
Serial.begin(9600);
pinMode( ledpin, OUTPUT); //initialize the led pin as output
pinMode( PIRpin, INPUT); //initialize the PIR pin as input
pinMode( buzzPin, OUTPUT); //initialize the buzzer pin as an output
}
int count = 0;
void loop() {
//Serial.print (count);
delay(1 * 100); //delay one hundred milliseconds
if (digitalRead(PIRpin) == HIGH) //Detecting whether the body movement information
{
count = 0;
digitalWrite(ledpin,LOW);//LED ON
}
else
{
count++;
}
if(count == 30)
{
digitalWrite(ledpin,HIGH);//LED ON
count=0;
}
}