Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

press button twice to trigger #5

Open
robinxyz1 opened this issue Aug 13, 2018 · 5 comments
Open

press button twice to trigger #5

robinxyz1 opened this issue Aug 13, 2018 · 5 comments

Comments

@robinxyz1
Copy link

I have a strange issue with button press. I have to press it twice quickly to trigger action. Pressing it just once or holding it down does not work.

Anyone have the same strange issue I have?

@bolish
Copy link

bolish commented Mar 11, 2019

Hi @robinxyz1 ,

I'm experiencing same issue on my side. But it's not really consistent ... Sometime 1 press is OK, sometimes, I need 2 press.

I'm even not sure if it's coming from the module or th buttons...

Did you managed to improve the situation on your side?

Note : buttons I'm using : Buttons

Regards

@robinxyz1
Copy link
Author

@bolish Yeah, my problem was because I did not initialize the GPIO pins. I added a startup script to set the pin state and mode for the pins used, that took care of it.

@bolish
Copy link

bolish commented Mar 19, 2019

hi @robinxyz1 ,

Thanks for feedback.
Is it something different than setting the Pull Up thing?
I've already added the following into my config.txt ':

# Change the pull on (input) pins 18 and 20
gpio=18,20=pu

But this doesn't seems to be enough.

Could you please let me know how to do your trick "initialize GPIO pins with startup script?

Regards

@robinxyz1
Copy link
Author

robinxyz1 commented Mar 19, 2019

Hi @bolish

MM was my first Pi project, I am not sure if initialization is the right word. My understanding is it sets the pin state (up/down) and mode (input/output).

In /etc/rc.local, I have a line to run a python script.

/usr/bin/python /home/pi/Initialize-GPIO/initialize-buttons.py

this is the content of initialize-buttons.py, I am using 3 pins, two buttons and an IR sensor.

import RPi.GPIO as GPIO
import time
GPIO.setmode(GPIO.BCM)
GPIO.setup(17, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(22, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)
GPIO.setup(27, GPIO.IN, pull_up_down=GPIO.PUD_DOWN)

HTH

@yhax
Copy link

yhax commented Mar 23, 2019

@bolish make sure you have the button wired correctly i.e. on the pin, and on power (use a resistor) not ground.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants