← index #7831Issue #2041
Off-topic · high · value 1.198
QUERY · ISSUE

ESP8266 Pin Get Physical Address

openby PsuFanopened 2021-09-21updated 2022-03-30
port-esp8266

Is there a way to get the physical address of a pin class? For example a IRQ pin handler, determine which pin has tripped?

from machine import Pin

def handle(p):
	print(int(str(p)[4:-1])) # Better way to get pin number 5?

pin = Pin(5, Pin.IN, Pin.PULL_UP)
pin.irq(trigger=Pin.IRQ_FALLING, handler=handle)
CANDIDATE · ISSUE

Pin Interrupts don't appear to take keyword arguments

closedby slzatzopened 2016-05-07updated 2016-05-08
port-esp8266

Documentation for esp at http://docs.micropython.org/en/latest/esp8266/esp8266/tutorial/pins.html

reads

>>> p0.irq(trigger=Pin.IRQ_FALLING, handler=callback)
>>> p2.irq(trigger=Pin.IRQ_RISING | Pin.IRQ_FALLING, handler=callback)

However, the irq method doesn't take keyword arguments but works fine with positional arguments.

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