Hi,
I’m trying to turn on/off the user LED in Micropython. Have not been successful so far. Normally, I just do something like:
led = machine.Pin(<PIN_NUMBER>, machine.Pin.OUT)
led.value(1)
… but I don’t know what the PIN_NUMBER would be for the user led.
Anyone know?
Thanks
-T
Hello, you can read the pin picture here:Getting Started | Seeed Studio Wiki , the name of pin is here: if you wanna use the pin D2, you can see D2 match the GPIO3, so you can use it by “IO3”, such as machine.Pin(IO3,machine.Pin.OUT)
or two lines like:
machine_pin= digitalio.DigitalInOut(board.IO3)
machine_pin.direction = digitalio.Direction.OUTPUT
Hi, it would help a lot if you could post a minimal working snippet.
where does “board” come from?
where does “digitalio” come from?
Thanks
malachi
January 16, 2024, 2:46am
#4
For those of you on esp-idf
directly, the user LED is IO21 per the schematics
Here is a code snippet using Pin 21:
from machine import Pin
Pin(21, Pin.OUT) # turn on the User LED
Pin(21, Pin.IN) # turn off the User LED