Deepsleep and wakeup on the same pin

  • 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):
    if int(p_in()) == 0:
    print("Setting %s to listen for wakeup" % (
    machine.pin_deepsleep_wakeup(['P3'],machine.WAKEUP_ALL_LOW, True)
    print("Going into deepsleep: %s" % (

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

  • 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

Pycom on Twitter