I'm using a SAMD21G18A based board - the arduino zero, for a battery-powered wearable project (a type of computer mouse). I put the device into sleep using the sleep function from the arduino low-power library.
I think the board is going to sleep when I call the .deepSleep() function, using serial to print, as you can see in the picture below. Also including the relevant code.
My issue is that a connected LED continues to work even after the device is put to sleep. The way I understood it, sleep should cut power to attached peripherals. Am I doing something wrong?
I looked through the source code from the library, but that was a dead end. Has anyone experienced a similar issue before?
void nomotion_sleep(float x_value) {
static float asum;
static byte i = 0;
static byte numberof_samples = 10;
static float sleep_threshold = numberof_samples + 5;
static uint32_t sleep_timer;
if (timer1(sleep_timer, 10000)) {
asum += fabs(x_value);
SerialUSB.println (asum);
i += 1;
if (i == numberof_samples - 1) {
if (asum < sleep_threshold) {
asum = 0;
SerialUSB.println ("sleep now");
//sleep
LowPower.deepSleep();
}
asum = 0;
i = 0;
}
}
}
