Ideally something like Pin.IRQ_FALLING that triggers a callback.
I tried to use this but it fails. Most llikely because you can't have RMT and Pin on the same pin at the same time.
Code: Select all
from utime import sleep_us, sleep
import esp32
from machine import Pin
counter = 0
def callback(p):
global counter
counter += 1
if __name__ == "__main__":
pulses = (10,)*48
r = esp32.RMT(0, pin=Pin(15), clock_div=80)
p = Pin(15, mode=Pin.OUT,)
p.irq(trigger=Pin.IRQ_FALLING, handler=callback)
while True:
if r.wait_done():
print(counter)
counter = 0
r.write_pulses(pulses, start=1)