← index #6538PR #6540
Duplicate · high · value 3.775
QUERY · ISSUE

machine.Pin doesn't have a pin() method on the ESP32 port

openby mattytrentiniopened 2020-10-10updated 2024-09-14
enhancementport-esp32

As reported in the Slack channel, the ESP32 port lacks a method to retrieve the pin number.

(It's possible to print the pin object but this is fragile and requires that the number be parsed from the string.)

The nRF and stm32 ports both have a pin() method on a Pin; the same should exist for the ESP32.

CANDIDATE · PULL REQUEST

Add Pin.pin() to ESP32 port to address #6538

closedby mattytrentiniopened 2020-10-11updated 2022-09-11
port-esp32

See #6538. Tested on TinyPICO:

MicroPython v1.13-103-gb137d064e-dirty on 2020-10-11; TinyPICO with ESP32-PICO-D4
Type "help()" for more information.
>>> from machine import Pin
>>> p = Pin(4)
>>> p
Pin(4)
>>> p.pin()
4

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied