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

    Deepsleep and wakeup on the same pin

    Scheduled Pinned Locked Moved WiPy 2&3
    deepsleep wakewipy 3.0button
    2 Posts 1 Posters 915 Views 1 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.
    • F Offline
      fsergeys
      last edited by

      I'm experimenting with a button to bring my Wipy to deepsleep and wakeup. Both are working individually, but not together. After going into deepsleep it immediately wakes up again. I guess the problem is due to the bouncing. I thought that I could solve the problem by setting the wakeup PIN just before going to sleep and after sufficient time to get passed by the bouncing. But that didn't work. See code below. Anybody suggestions?

      def pin_handler(arg):
      time.sleep(0.5)
      irqCounter.append(irqCounter[-1]+1)
      #print(irqCounter[-1],"--",p_in())
      if int(p_in()) == 0:
      print("Setting %s to listen for wakeup" % (arg.id()))
      machine.pin_deepsleep_wakeup(['P3'],machine.WAKEUP_ALL_LOW, True)
      print("Going into deepsleep: %s" % (arg.id()))
      machine.deepsleep(10000)

      p_in = Pin('P3', mode=Pin.IN, pull=Pin.PULL_UP)
      p_in.callback(Pin.IRQ_FALLING, pin_handler)

      1 Reply Last reply Reply Quote 0
      • F Offline
        fsergeys
        last edited by

        Solved: just needed to increase the timeout to 2 seconds before setting
        machine.pin_deepsleep_wakeup(['P3'],machine.WAKEUP_ALL_LOW, True)
        and then going into deepsleep

        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