Setting Pin to High
-
I`m having trouble setting pins to High, for output.
Is this the right way to do it?Tpin=Pin.init(Pin.OUT)
Tpin.value(1) -
You need to specify which pin it is. Check the pinout post to find the pin label for the one you want.
Here's an example for pin P23.
from machine import Pin tpin=Pin('P23',Pin.OUT) tpin.value(1) -
@jmarcelino Hey, I did that, just forgot to put it in the post.
if you do
.....from machine import Pin
tpin=Pin('P23',Pin.OUT)
tpin.value(1)
print(tpin.value())Do you get 1 ?
-
@Knoahlr
I don't have my WiPy nearby to test but note that for pins set as Pin.OUT the behaviour and return value of the value() is undefined, you can't really trust it will match what you sent.See https://micropython.org/resources/docs/en/latest/wipy/library/machine.Pin.html
Hello! It looks like you're interested in this conversation, but you don't have an account yet.
Getting fed up of having to scroll through the same posts each visit? When you register for an account, you'll always come back to exactly where you were before, and choose to be notified of new replies (either via email, or push notification). You'll also be able to save bookmarks and upvote posts to show your appreciation to other community members.
With your input, this post could be even better 💗
Register Login