Skip to content
  • MySensors
  • OpenHardware.io
  • Categories
  • Recent
  • Tags
  • Popular
Skins
  • Light
  • Brite
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Brand Logo
  1. Home
  2. Development
  3. sleep() in MySensors 2.2.0

sleep() in MySensors 2.2.0

Scheduled Pinned Locked Moved Development
5 Posts 3 Posters 899 Views 3 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • alexsh1A Offline
    alexsh1A Offline
    alexsh1
    wrote on last edited by
    #1

    Hello all,

    I have read about a long discussion about sleep() in MySensors with @AWI and @Yveaux discussing that for PIR sensors sleep must be used with "LOW" interrupt according to atmega328p spec. However, I did try it and it just does not work. If I change

    sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
    

    to anything like

    sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), LOW, SLEEP_TIME);
    

    my PIR stops working.
    I cannot use smartSleep() as I have Domoticz.

    What's the final verdict? How sleep function has to be used please?

    YveauxY 1 Reply Last reply
    0
    • gohanG Offline
      gohanG Offline
      gohan
      Mod
      wrote on last edited by
      #2

      If you set it on "high"?

      alexsh1A 1 Reply Last reply
      0
      • alexsh1A alexsh1

        Hello all,

        I have read about a long discussion about sleep() in MySensors with @AWI and @Yveaux discussing that for PIR sensors sleep must be used with "LOW" interrupt according to atmega328p spec. However, I did try it and it just does not work. If I change

        sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), CHANGE, SLEEP_TIME);
        

        to anything like

        sleep(digitalPinToInterrupt(DIGITAL_INPUT_SENSOR), LOW, SLEEP_TIME);
        

        my PIR stops working.
        I cannot use smartSleep() as I have Domoticz.

        What's the final verdict? How sleep function has to be used please?

        YveauxY Offline
        YveauxY Offline
        Yveaux
        Mod
        wrote on last edited by
        #3

        @alexsh1 it is a bug in the atmega datasheet that only certain levels can be used. Change should also work, although it might give two wakes for each trigger.
        Make sure to use mySensors 2.2.x as some issues with waking from sleep by interrupts have been fixed.

        http://yveaux.blogspot.nl

        alexsh1A 1 Reply Last reply
        1
        • gohanG gohan

          If you set it on "high"?

          alexsh1A Offline
          alexsh1A Offline
          alexsh1
          wrote on last edited by
          #4

          @gohan I have not tried it. All I can say is that LOW does not work for PIRs. At least in my setup

          1 Reply Last reply
          0
          • YveauxY Yveaux

            @alexsh1 it is a bug in the atmega datasheet that only certain levels can be used. Change should also work, although it might give two wakes for each trigger.
            Make sure to use mySensors 2.2.x as some issues with waking from sleep by interrupts have been fixed.

            alexsh1A Offline
            alexsh1A Offline
            alexsh1
            wrote on last edited by
            #5

            @yveaux thank you!

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            14

            Online

            11.7k

            Users

            11.2k

            Topics

            113.1k

            Posts


            Copyright 2025 TBD   |   Forum Guidelines   |   Privacy Policy   |   Terms of Service
            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • MySensors
            • OpenHardware.io
            • Categories
            • Recent
            • Tags
            • Popular