sensor Pir

Good afternoon,

Have here a pir sensor detects movement when the wire has 4.80ve not detect when the thread is 0.06v.
It turns out that I wanted for the arduino to sleep, and when it detects movement up the Arduino wakes up.

Throughout the project I have the keypad to wake the Arduino. But I can not for the sensor to wake the Arduino.

My test code

#include <avr/sleep.h>
#include <VirtualWire.h> // lib para RF~

void setup()
{
pinMode(13, OUTPUT);
pinMode(2, INPUT);
digitalWrite(2, HIGH);
vw_set_tx_pin(3); // porta que vamos usar
vw_setup(2000); // bits para comunicação
}

void loop(){
digitalWrite(13, HIGH);
delay(3000);
enterSleep();
}

void pin2Interrupt(){

}

void enterSleep()
{
digitalWrite(13, LOW);
attachInterrupt(0, pin2Interrupt, LOW);
delay(50);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
ADCSRA &= ~(1 << ADEN);
sleep_mode();
detachInterrupt(0);
sleep_disable();
}

  attachInterrupt(0, pin2Interrupt, LOW);

Not to wake from sleep. You really need to study what the various options are for the interrupt trigger, and choose the appropriate one. LOW is rarely the correct choice.

I try attachInterrupt(0, pin2Interrupt, RISING); and attachInterrupt(0, pin2Interrupt, FALLING), but not work.

I tried a few that caught on google but could also not.

Its very important for me to finish this part of the project.

Good afternoon,
after studying a little more about sleep mode developed the following code which works without problem in ATMEGA328.
The problem is that the same code does not work on atmega8. Neither the led 13 when it sends the message.
I wanted to ask for help for this weird problem.

I thank you.

#include <avr/sleep.h>
#include <VirtualWire.h> // lib para RF

long tempofinal =0;
long prev = 0;

int led = 13;
int estado =0;

void setup()
{
pinMode(2, INPUT);
pinMode(led, OUTPUT);
vw_set_tx_pin(9); // porta que vamos usar
vw_setup(2000); // bits para comunicação
}

void loop(){
enterSleep();
estado = digitalRead(2);
while( estado == HIGH){
tempofinal = millis() - prev ;
estado = digitalRead(2);
if (estado == LOW){
break;
}
if (tempofinal > 5000){
prev = millis();
pin2Interrupt();
}
}
}
void pin2Interrupt(){
detachInterrupt(0);
digitalWrite(led,HIGH);
for(float i=0;i<10000;i++){}
const char *msg = "3";
vw_send((uint8_t *)msg, strlen(msg));
digitalWrite(led,LOW);
}

void enterSleep()
{
attachInterrupt(0, pin2Interrupt,RISING);
delay(100);
set_sleep_mode(SLEEP_MODE_PWR_DOWN);
sleep_enable();
sleep_mode();

sleep_disable();
}