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)
-
@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
-
@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 ?
-
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)