Open robinxyz1 opened 6 years ago
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
@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.
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
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
@bolish make sure you have the button wired correctly i.e. on the pin, and on power (use a resistor) not ground.
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?