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!