MMM-Buttons icon indicating copy to clipboard operation
MMM-Buttons copied to clipboard

press button twice to trigger

Open robinxyz1 opened this issue 7 years ago • 5 comments

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?

robinxyz1 avatar Aug 13 '18 20:08 robinxyz1

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 avatar Mar 11 '19 10:03 bolish

@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.

robinxyz1 avatar Mar 19 '19 05:03 robinxyz1

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

bolish avatar Mar 19 '19 08:03 bolish

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

robinxyz1 avatar Mar 19 '19 16:03 robinxyz1

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

yhax avatar Mar 23 '19 03:03 yhax