← index #6538Issue #4816
Off-topic · high · value 3.988
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 · ISSUE

`AttributeError: 'Pin' object has no attribute 'on'`

closedby cool-RRopened 2019-05-27updated 2020-10-21
port-esp32

On my ESP32, this happens:

>>> import machine                                
>>> p = machine.Pin(2, machine.Pin.OUT)           
>>> p.on()                                        
Traceback (most recent call last):                
  File "<stdin>", line 1, in <module>             
AttributeError: 'Pin' object has no attribute 'on'

Even though the docs say that the Pin.on method works.

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