Hello I am using the below code to sleep XBee from Arduino. I connect a wire from digital pin of arduino to pin number 9 of XBee. I also configure XBee from XCTU to make it sleep mode.
The below code sleep the Arduino but not waking up? Anything more to do to wake XBee up
#include <avr/sleep.h>
#define XBEE_sleepPin 6
void setup() {
Serial.begin(9600);
}
void xbeesleep() {
Serial.println("sleep");
delay (3000);
pinMode (XBEE_sleepPin,OUTPUT); // put XBee to sleep0
digitalWrite(XBEE_sleepPin,HIGH); // Setting this pin to LOW turns off the pull up resistor, thus saving precious current
}
void xbeewake() {
Serial.println("wake");
pinMode(XBEE_sleepPin,OUTPUT); // Set the "wake-up pin" to output
digitalWrite(XBEE_sleepPin,LOW); // wake-up XBee
delay(1000); //make sure that XBee is ready
}
int i = 0;
void loop() {
if (i==0)
{
xbeewake();
}
else if (i==5)
{
xbeesleep();
}
if (i<5)
{
Serial.println(i);
}
i = (i+1) % 10;
delay(3000);
}