Hi,
I’m trying to set XBee to sleep mode 4 in order to save power.
My application has to take a sample from a sensor, send it over Xbee and then go to sleep for about 10 seconds.
So, I think that Sleep Mode 4 is what I need.
I’ve setted up the module SM, ST and SP parameters but I don’t understand what happen.
Here the code:
temperature = sonda_i2c_readTemperature();
(void)xbee_cmd_simple(&xdev, "SP", 1000); //10sec
(void)xbee_cmd_simple(&xdev, "ST", 0x1F40); //wake up for about 8s then go to sleep again
(void)xbee_cmd_simple(&xdev, "SM", 4); //set the module in SleepMode 4
for (;;) {
/* Nothing to do...
* Everything is done in the periodic task
*/
}
After some seconds the module seems to go to sleep (power go down from 35mA to 12mA) but it don’t wake up after 10second as I need.
Is there something wrong in the code?
Please help.
Thank you