Raspberry Pi Pico - MicroPython - Simple Tutorials - Lesson 8: Messing with buttons/GPIO.

Поделиться
HTML-код
  • Опубликовано: 16 дек 2024
  • ХоббиХобби

Комментарии • 18

  • @jyvben1520
    @jyvben1520 Год назад +2

    Or use led.toggle() without sleep, it stays on till you press the button again. (no predefined on time)
    Another way to have immediate action on press/release led.value(button.value())

  • @robloxmaster2706
    @robloxmaster2706 Год назад

    What is the resistor its resistance?

  • @nikolainikolaev2904
    @nikolainikolaev2904 2 года назад

    I can't seem to figure it out. My Pico thinks that the button is always pressed and outputs a "1" all the time. I have a second button that I tried, but it does the same. Exact same button as in your video. Any idea why?

    • @AntonyCartwright
      @AntonyCartwright  2 года назад

      Hello! Pull the button out, does it now show 0?

    • @nikolainikolaev2904
      @nikolainikolaev2904 2 года назад

      @@AntonyCartwright yeah when I pull the button out, it shows 0. When I connect the button, its as if it was already pressed. I ordered some new buttons, perhaps got a bad batch.

    • @AntonyCartwright
      @AntonyCartwright  2 года назад

      Put an ohmmeter across the terminals of the button. You'll probably see that the terminal configuration is different to that of my buttons.

    • @nikolainikolaev2904
      @nikolainikolaev2904 2 года назад

      @@AntonyCartwright So I figured it out. I almost went crazy. I changed buttons, I even changed raspberry pi pico. Basically, my problem was that I didn't put the button on top of the separation line of the breadboard, but on one side only. This meant that two of the four pins of the button were always connected. Gotta put it over that line for it to work

    • @AntonyCartwright
      @AntonyCartwright  2 года назад

      @@nikolainikolaev2904 Ahh, I see!

  • @krypton1142
    @krypton1142 2 года назад

    How do i add 2 or more buttons at the same time?

    • @Larry2kYT
      @Larry2kYT 2 года назад

      just repeat what you did for the first one but in different spots its quite easy

  • @electronic7979
    @electronic7979 2 года назад +1

    👍

  • @godstimeoghenevwedeobruche4051

    Pls improve the code to make the led constant HIGH if button.value() == 1; by just one click. And set it to constant LOW if button.value() == 0; by another click.
    Please, i have be struggling with that.

  • @colind7875
    @colind7875 3 месяца назад

    MY Code gives error Traceback (most recent call last):
    File "", line 4, in
    AttributeError: type object 'Pin' has no attribute 'PUll_DOWN'
    Please help?
    import machine
    import utime
    button = machine.Pin(15, machine.Pin.IN, machine.Pin.PUll_DOWN)
    while True:
    print(button.value())
    utime.sleep(1)

  • @Sekhar_Home
    @Sekhar_Home 2 года назад

    Is this the first video on micro Python? Welcome

  • @Sup_ERS_Tar
    @Sup_ERS_Tar 2 года назад

    Is this your first time watching a micro Python video?