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

Button not working with gpiozero #1138

Open
harshvardhanagrawal opened this issue Apr 4, 2024 · 4 comments
Open

Button not working with gpiozero #1138

harshvardhanagrawal opened this issue Apr 4, 2024 · 4 comments

Comments

@harshvardhanagrawal
Copy link

harshvardhanagrawal commented Apr 4, 2024

Operating system: Debian GNU/Linux 12 (bookworm)
Python version: 3.11.2
Pi model: Pi 5 Model B
GPIO Zero version: 2.0
Pin factory used: LGPIOFactory

Basic button functioning is not working with gpiozero module. I tried using the basic example given in https://github.com/gpiozero/gpiozero/blob/master/docs/examples/button_1.py


button = Button(23)

while True:
    if button.is_pressed:
        print("Button is pressed")
    else:
        print("Button is not pressed")

Button Press is not being detected with the above code.

I am using a 4-pin button with one pin connected to vcc (3.3V) and the other is input pin
->Connections are okay as I am able to detect using gpiod module
->gpiozero installation is okay as I am able to turn on led using gpiozero.

@harshvardhanagrawal harshvardhanagrawal changed the title Button not working with gpiozero but working with gpiod Button not working with gpiozero Apr 4, 2024
@bennuttall
Copy link
Member

Do you get an error? Are you in a virtualenv? How did you install lgpio?

@harshvardhanagrawal
Copy link
Author

Do you get an error? Are you in a virtualenv? How did you install lgpio?

  1. I do not get any error,
    ‘’’button.is-pressed’’’ prints false
  2. I am running it on the system-installed python environment.
  3. I did not install it explicitly.

@ValentinSvidrigaylov
Copy link

same issue here, same setup as yours, did you manage to fix it somehow?

@harshvardhanagrawal
Copy link
Author

same issue here, same setup as yours, did you manage to fix it somehow?

Nah. I switched to gpiod for now.

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