How to Use Push Buttons With Raspberry Pi GPIO (with Python gpiozero)

Поділитися
Вставка
  • Опубліковано 8 січ 2025

КОМЕНТАРІ •

  • @jonani1746
    @jonani1746 4 роки тому +53

    Very good tutorial, much better than anything else out there.

  • @nb8280
    @nb8280 Рік тому +1

    As this code is in its own module, any constants (led1, led2) should be declared ahead of a function where they're used (go_blink). This makes understanding scope a little easier for beginners, IMO. My only beef -- thanks for the tutorial!

  • @Compuscience-Python-Prog-Exps

    Oh, and you are also on my recommendations list, since before spring arrived.
    I keep all the advanced electronic videos on the bottom, due to not that many people
    will probably go there, but if they do go there, they will find the best people about
    the raspberry pi machine. You are one of them people who actually helped me lay out my
    Pi the way I've got set up. Please know and see that I took your advice. If you look,
    you will find. I did EXACTLY AS YOU TAUGHT ME!-:)) I do not regret it. You are the best at
    my layout design. I took it right after you, in the very same image. I use a breadboard
    by itself as the power to all the other breadboards I have three on a Jamiko Breadboard
    set tray. I use the other, forth one as my power, separate from the Jamiko ones. The one
    I use came with an electronics kit, I bought and so far I only lost a light because I forgot
    a resistor. lol I can only hope you look at my Raspberry Pi videos. I hope you like them.
    Thanks so much again...

  • @shawnbakhtiar9768
    @shawnbakhtiar9768 Рік тому

    Excellent video!!! This modality definitely worked better for the code I am implement. Thank you very much, and look forward to checking out the rest of the tutorials :)

  • @BartdeBoisblanc
    @BartdeBoisblanc Рік тому +1

    This is a very helpful tutorial. I am planning to use this sort of code along with PYQT5 to create a water tank automation.

  • @tumieengineering5908
    @tumieengineering5908 3 місяці тому

    This is awesome! The new library is simple and easy to use. Love the event features. I have a problem with my button triggering multiple times with one press randomly. Is there a way to ignore multiple button presses within a specified time?

    • @m.heidenreich
      @m.heidenreich  3 місяці тому

      Button class has a "bounce_time" property - set it to an appropriate value to counteract bounce.

  • @biancafioretti9942
    @biancafioretti9942 Рік тому

    I've been facing problems with my project for weeks and your video solved it in seconds! If I want to use the same button on multiple screens to activate different functions, would I get the GPIO conflict error like what happens with the RPi.GPIO library?

    • @m.heidenreich
      @m.heidenreich  Рік тому

      You should not have conflicts with gpiozero as long as you implement/use your buttons correctly. Unfortunately RPi.GPIO makes button usage very difficult and this is why I do not recommend it.

  • @igoutta
    @igoutta Рік тому

    Thank you so much, just that global you put it there, really really kills ,e/

  • @kasdiqiu5417
    @kasdiqiu5417 17 днів тому

    Thank you, can i replace the LED to a relay and just press button ON and press same button OFF.

    • @m.heidenreich
      @m.heidenreich  17 днів тому

      You cannot simply replace an LED with a relay in a simple GPIO circuit. A relay draws too much power and it needs a flywheel diode - you will damage or destroy your Pi. I have an upcoming video on how to use a relay, so stay tuned.

  • @definitesquare
    @definitesquare Рік тому

    Great video!!! Thanks a lot

  • @spawn666reaper
    @spawn666reaper Рік тому +1

    I keep readying that if you have a button you need to attach a resistor to it to protect the pi. Is that true?

    • @m.heidenreich
      @m.heidenreich  Рік тому

      Raspberry Pi has software-controlled pull-up/pull-down resistors integrated in the chipset. This is why buttons are attached directly to the Pi.

  • @viral.vr2
    @viral.vr2 5 місяців тому

    amazing 🙌

  • @TooSlowTube
    @TooSlowTube 9 місяців тому

    The problem is you are not limiting the current through the pin if it's accidentally set as an output. I explained, more but it just got deleted by YT.

    • @m.heidenreich
      @m.heidenreich  9 місяців тому

      You can also accidentally connect 5V to GPIO or short 3.3V to GND etc. There is always an element of damage risk when you work with Pi headers directly. My suggestion is to keep circuits as simple as possible.

  • @ammonsequiptment9877
    @ammonsequiptment9877 Рік тому

    Helpful thanks