# System.sleep(seconds) broken in 0.6.0?

**URL:** <https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408>\
**Category:** Troubleshooting\
**Created:** [February 20, 2017, 2:10am UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408 "2017-02-20T02:10:20Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Ric](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ric/32/514_2.png) [@Ric](https://community.particle.io/u/Ric)\
**Post date:** [February 20, 2017, 2:10am UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408/1 "2017-02-20T02:10:20Z")

</div>

My Photon never wakes up with this simple code,

```cpp
void setup() {
    Time.zone(-8);
    Serial.begin(9600);
    delay(3000);
    Serial.println("Starting");
}

void loop() {
    
    if (Time.hour() == 18 && Time.minute() == 0 && Time.second() == 0) {
        Serial.printlnf("Min: %d Sec: %d", Time.minute(), Time.second());
        delay(2000);
        System.sleep(15);
    }
}

```

I get a single print out, and the Photon breathes white. Is this broken, or did I miss some change in the way this sleep mode works?

---

<div class="post-metadata">

**Author:** ![calebatch](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/calebatch/32/23894_2.png) [@calebatch](https://community.particle.io/u/calebatch)\
**Post date:** [February 20, 2017, 5:42am UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408/2 "2017-02-20T05:42:58Z")

</div>

Your code appears to only print once a day at exactly 18:00:00.  
Try removing the Time.hour() == 18 from your code and see what it does. The sleep mode you are using keeps running code and turns off your wifi for 15 seconds. Try changing to

`System.sleep(wakeUpPin, edgeTriggerMode, seconds);`

if you want to treat sleep as a delay() or use

```
`System.sleep(SLEEP_MODE_DEEP, seconds);`

```

if you want the device to reset after sleeping.

---

<div class="post-metadata">

**Author:** ![Ric](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ric/32/514_2.png) [@Ric](https://community.particle.io/u/Ric)\
**Post date:** [February 20, 2017, 5:58am UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408/3 "2017-02-20T05:58:06Z")

</div>

> [@calebatch](#):
>
> Your code appears to only print once a day at exactly 18:00:00

That's what I wanted it to do. It's just a test. The problem is, when I ran this just before 6PM, the Wi-Fi never came back on after 15 seconds.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 20, 2017, 9:45am UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408/4 "2017-02-20T09:45:07Z")

</div>

I did see that same behaviour, but I never really saw any use in this (crippled, not deserving the name) “sleep()” mode anyway, so I never investigated further 😉

---

<div class="post-metadata">

**Author:** ![Ric](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/ric/32/514_2.png) [@Ric](https://community.particle.io/u/Ric)\
**Post date:** [February 20, 2017, 5:04pm UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408/5 "2017-02-20T17:04:03Z")

</div>

> [@ScruffR](#):
>
> I never really saw any use in this (crippled, not deserving the name) "sleep()" mode anyway

Apparently, other people don't either, since this has gone unnoticed for a while. It did work back in march when [this](https://community.particle.io/t/sleep-mode-explained-using-code-samples/21173) was posted. I was just testing it in response to another question I was responding to; I don't think I've ever used it before. Maybe it's time to retire this function.

---

<div class="post-metadata">

**Author:** ![Thepointof](https://avatars.discourse-cdn.com/v4/letter/t/eb8c5e/32.png) [@Thepointof](https://community.particle.io/u/Thepointof)\
**Post date:** [February 21, 2017, 9:17pm UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408/6 "2017-02-21T21:17:07Z")

</div>

I’ve had the same problem.  
WiFi.off helpped save power, but then I found Deep Sleep works which is good enough for me.

---

<div class="post-metadata">

**Author:** ![ScruffR](https://sea2.discourse-cdn.com/flex026/user_avatar/community.particle.io/scruffr/32/6952_2.png) [@ScruffR](https://community.particle.io/u/ScruffR)\
**Post date:** [February 21, 2017, 9:22pm UTC](https://community.particle.io/t/system-sleep-seconds-broken-in-0-6-0/29408/7 "2017-02-21T21:22:37Z")

</div>

A fix for this issue is slated for 0.7.0

> <https://github.com/particle-iot/firmware/issues/1233>
