Hello,
I have been having some trouble getting the waspmote to wake from hibernate. I have run the basic codes, and they work as expected. I have copied in my code for you to look at. It seems to get to the point where the LEDs blink, the first time, but then gets stuck somewhere in the method call when it comes out of hibernate. It never gets to the point where the LEDs flash for a long period of time at the end of the method (in order to see that the SD write is sucessful each time a line is written).
Thanks!
Quote:
void setup(){
USB.begin();
USB.println("USB Started.");
SD.begin();
SD.setMode(SD_ON);
SD.init();
RTC.ON();
USB.println("Initialize RTC");
PWR.ifHibernate();
if (SD.create("TemperatureData.txt")){
USB.println("Successfully created TemperatureData.txt.");
}
else{
USB.println("Temperature.txt not successfully created, check for existing files.");
}
}
void loop(){
Utils.blinkLEDs(1000);
// RTC.setTime("12:06:07:05:11:24:00");
if( intFlag & HIB_INT ) {
Utils.blinkLEDs(1000);
hibInterrupt();
}
PWR.hibernate("00:00:00:10",RTC_OFFSET,RTC_ALM1_MODE2);
}
void hibInterrupt()
{
SD.begin();
SD.setMode(SD_ON);
SD.init();
char temperature_data[10]="";
Utils.float2String(RTC.getTemperature(),temperature_data,5);
// USB.print("Time: ");
// USB.println(RTC.getTime());
Utils.blinkLEDs(1000);
// USB.print(",Temperature(Celcius): ");
// USB.print(RTC.getTemperature(),DEC);
// USB.println("]");
//
SD.writeSD("TemperatureData.txt",temperature_data,20);
SD.writeSD("TemperatureData.txt",RTC.getTime(),20);
if(!SD.appendln("TemperatureData.txt",temperature_data)){
USB.println("Temperature Data Write Unsuccessful");
}
if(!SD.appendln("TemperatureData.txt",RTC.getTime())){
USB.println("Temperature Data Time Write Unsuccessful");
}
Utils.blinkLEDs(1000);
Utils.blinkLEDs(1000);
Utils.blinkLEDs(1000);
Utils.blinkLEDs(1000);
Utils.blinkLEDs(1000);
intFlag &= ~(HIB_INT);
}