user button configuration
-
I want to print a msg when i press a user button on the pycom board,
but i get about 92 msgs when i press the button only once !import machine button=machine.Pin("G17", machine.Pin.IN, machine.Pin.PULL_UP) while(True): if(button.value()==0): print("presssss !!!!")How can i configure the button so that when i press once only i get a single output(msg)
thanks
-
-
Quick solution is to use pull_up resistor like you did and create empty while loop when value is 0.
Then after releasing the button add a small delay, ~100 ms will do. Then add futher statements after the delay. -
thanks @RobTuDelft It worked well
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