Welcome to the Pycom forum Forum
    • \[\[global:header.categories\]\]
    • \[\[global:header.recent\]\]
    • \[\[global:header.tags\]\]
    • \[\[global:header.popular\]\]
    • Login

    Explore Pybytes | Official Documentation | Report a Firmware Bug/Issue | GitHub

    accelerometer wake not working

    Scheduled Pinned Locked Moved Comments & Feedback
    accelerometerwakenot working
    6 Posts 3 Posters 571 Views 3 Watching
    Loading More Posts
    • 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.
    • D Offline
      devinv
      last edited by

      hello,

      I tryed the code

      from pytrack import Pytrack
      #from pysense import Pysense
      from LIS2HH12 import LIS2HH12
      import pycom
      import time
      
      pycom.heartbeat(False)
      
      py = Pytrack()
      # py = Pysense()
      
      print("Wakeup reason: " + str(py.get_wake_reason()) + "; Aproximate sleep remaining: " + str(py.get_sleep_remaining()) + " sec")
      time.sleep(0.5)
      
      py.setup_int_pin_wake_up(False)
      
      py.setup_int_wake_up(True, True)
      
      acc = LIS2HH12()
      acc.enable_activity_interrupt(2000, 200)
      
      # check if we were awaken due to activity
      if acc.activity():
          pycom.rgbled(0xFF0000)
      else:
          pycom.rgbled(0x00FF00)  # timer wake-up
      time.sleep(0.1)
      py.setup_sleep(300)
      py.go_to_sleep()
      

      And it never wakes up. Not after 5 minutes nor with serious shaking.

      What am I missing?
      I saw other topics with a similar problem but unsolved. Is it something which is not supposed to work?

      J 1 Reply Last reply Reply Quote 0
      • P Offline
        Paul Thornton
        last edited by

        The code looks correct.

        I dont have a Pytrack to hand untill tomorrow. If no one has responded by then Ill take a look and see if I cant work out what's going on.

        D 1 Reply Last reply Reply Quote 0
        • D Offline
          devinv @Paul Thornton
          last edited by

          @paul-thornton thank you

          1 Reply Last reply Reply Quote 0
          • J Offline
            jcaron @devinv
            last edited by

            @devinv Did you update the Pytrack firmware to the latest version (0.0.9)? You can check it using py.read_fw_version.

            If you keep just py.setup_sleep and py.go_to_sleep, does it wake up after the given time?

            Note that in your script, the board will go back to sleep nearly immediately after waking up. Given the time it takes for USB to come up, your only hint of a wake up will be a 100 ms flash of the LED.

            Note also that it takes a little while for the board to wake up, so if you want to know the reason for the wake up, you should indeed use get_wake_reason rather than acc.activity (which will give you the state when you call it, not when it woke up).

            D 1 Reply Last reply Reply Quote 0
            • D Offline
              devinv @jcaron
              last edited by

              @jcaron 0.0.9?? where do I get that? I'm on 0.0.8. I thought it was the latest one?
              You mean it doesn't work on 0.0.8 version?

              1 Reply Last reply Reply Quote 0
              • D Offline
                devinv
                last edited by

                @jcaron any news?

                1 Reply Last reply Reply Quote 0

                Hello! It looks like you're interested in this conversation, but you don't have an account yet.

                Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.

                With your input, this post could be even better đź’—

                Register Login
                • 1 / 1
                • First post
                  Last post

                Pycom on Twitter

                Pycom