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())
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 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 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
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.
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())
What is the resistor its resistance?
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?
Hello! Pull the button out, does it now show 0?
@@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.
Put an ohmmeter across the terminals of the button. You'll probably see that the terminal configuration is different to that of my buttons.
@@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
@@nikolainikolaev2904 Ahh, I see!
How do i add 2 or more buttons at the same time?
just repeat what you did for the first one but in different spots its quite easy
👍
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.
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)
PUll_DOWN >>>>> PULL_DOWN
Thank
Is this the first video on micro Python? Welcome
No, this is the 8th. Antony..
Is this your first time watching a micro Python video?