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):
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) -
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
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