Our code appears to be working properly, but I cannot seem to get a value returned with RTC.getTime(). It simply returns an empty string.
Here is the setup() function:
Quote:
// setup initialization function
void setup()
{
// init USB communications
USB.begin();
USB.print("\nconfiguring ");
USB.print(DEF_ID_MOTE);
USB.println("...");
// enable RTC, Accelerometer
ACC.ON();
USB.println("...set ACC to on");
delay(300);
RTC.ON();
USB.println("...set RTC to on");
delay(300);
// set the RTC clock
RTC.setTime("00:01:01:00:12:00:00");
USB.print("...RTC clock initialized to ");
USB.println(RTC.getTime());
// setup complete
flash_leds(4);
USB.print("\nstarting...");
USB.print(DEF_ID_MOTE);
USB.println("...");
}
In the loop() function, we use the following to print the values to USB...
Quote:
// get sensor data and send
cnt++;
sprintf(aux,"TS[%s] DATA: %d -x:%d,y:%d,z:%d -temp:%d -bat:%d%c",
RTC.getTime(),cnt,ACC.getX(),ACC.getY(),ACC.getZ(),(int)RTC.getTemperature(),PWR.getBatteryLevel(),'%');
USB.println(aux);
The output from this looks like the following:
Quote:
configuring SF-LOCENV--00001...
...set ACC to on
...set RTC to on
...RTC clock initialized to
starting...SF-LOCENV--00001...
sleeping... 15 sec
handle ACC INTERRUPT...
TS[] DATA: 1 -x:-27,y:32,z:1056 -temp:27 -bat:97%
sleeping... 15 sec
handle RTC INTERRUPT...
TS[] DATA: 2 -x:-27,y:32,z:1056 -temp:27 -bat:97%
sleeping... 15 sec
...
As you can see, the there is no time printed after "...RTC clock initialized to" and nothing in "TS[]" either. It appears that RTC.getTime() returns an empty string.
Has anybody experienced this problem before?
Cheers,
Cryptik