This example shows how to set low power mode
File:
"WaspXBee802_4_settingLowPowerMode.pde"
/*
* ------Waspmote XBee 802.15.4 Setting Low Power Mode Example------
*
* Explanation: This example shows how to set low power mode
*
* Note: XBee modules must be configured at 38400bps and with API enabled.
*
* Copyright (C) 2009 Libelium Comunicaciones Distribuidas S.L.
* http://www.libelium.com
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 2 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see .
*
* Version: 0.1
* Design: David Gascón
* Implementation: Alberto Bielsa
*/
long previous=0;
uint8_t estado=0;
void setup()
{
// Inits the XBee 802.15.4 library
xbee802.init(XBEE_802_15_4,FREQ2_4G,NORMAL);
// Powers XBee
xbee802.ON();
}
void loop()
{
// Getting MAC
xbee802.getOwnMac();
if( !xbee802.error_AT ) XBee.println("MAC received OK");
else XBee.println("Error while getting MAC");
// Setting Sleep Mode
xbee802.setSleepMode(1);
if( !xbee802.error_AT ) XBee.println("Sleep Mode set OK");
else XBee.println("Error while setting Sleep Mode");
// Sleeping
xbee802.sleep();
if( !xbee802.error_AT ) XBee.println("Sleep OK");
else XBee.println("Error while entering to Sleep");
// Getting MAC
xbee802.getOwnMac();
if( !xbee802.error_AT ) XBee.println("MAC received OK");
else XBee.println("Error while getting MAC");
// Waking up
xbee802.wake();
if( !xbee802.error_AT ) XBee.println("Waked up OK");
else XBee.println("Error while waiking up");
}
You can download the code of this example.