Wake Arduino up after Sleep

Hi, I'm currently doing a project about wireless weather station.
I've written a program so that the arduino can send temperature data and goes to sleep for 5 seconds. But after uploading the program arduino could only send data once and can't wake up again.

My code is as below:

#include <avr/sleep.h>

float tempAnalogData;
float tempDigitalData;
int tempPin = 0;

void setup()
{
Serial.begin(9600);
}

void sleepNow()
{

set_sleep_mode(SLEEP_MODE_PWR_SAVE);

sleep_enable();

sleep_mode();
}

void loop()
{
tempAnalogData = analogRead(tempPin); //read the value from the sensor
tempDigitalData = (5.0 * tempAnalogData * 100.0)/1024.0; //convert the analog data to temperature
Serial.print(tempDigitalData); //send the data to the computer
Serial.println(" C");

sleepNow();
delay (5000);
}

Could you please help me on how to modify this code for waking up function?

Any help is well appreciated. Thanks! :slight_smile:

You either need a source of external interrupts or to enable the watchdog.
Search the forum - there was a thread not long ago.

Here:http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1263247150

I'm a newb and a noob on this thing. The discussion in the thread you show is too complicated. Could you please help me to explain what's the differences between "external interrupts" and "enable the watchdog"

Thanks.

There's an example in the thread, reply 15
If you work through it, you should be able to see how to incorporate your sketch.