QUERY · ISSUE
machine.Pin doesn't have a pin() method on the ESP32 port
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
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