microPython on esp32 C3 mate error InvalidPin when use GP19 for relay.
-
User
Hi,
With microPython on esp32 C3 mate, I would like to use a 3A Relay unit, for that I use GP19 which are also dedicate for USA D+, with the following code:
'''python3
import machine
...
relay = machine.Pin("GP19", machine.Pin.OUT)
...
if temp > 42:
...
relay.value(1)
elif temp < 40:
...
relay.value(0)
else:
pass
...
'''But I have this error:
Traceback (most recent call last):
File "main.py", line 7, in <module>
ValueError: invalid pinDo you know why?
Is it possible to use GP19 for a relay even if this Pin is dedicate to USA D+?Thanks you,
Sebastien -
Why don't you use the 1st argument (pin number) in integer format ?
-
the GP is not required, only numbers are required.
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