You need to not have the "()" after enter_password.mehdi_ziyaei wrote: ↑Tue Jun 04, 2019 1:04 ampin_starter= Pin(5 ,Pin.IN ,handler = enter_password() ,trigger = Pin.IRQ_RISING)
Code: Select all
pin_starter= Pin(5 ,Pin.IN ,handler = enter_password ,trigger = Pin.IRQ_RISING)
Yes. That's how it works - once you register an IRQ, it is always active. You should only do this once.mehdi_ziyaei wrote: ↑Tue Jun 04, 2019 1:04 amThe second irq is always active and calls the callback function with a knock detection
I'm sorry this isn't an easy problem you're trying to solve.
Can you start with a simpler problem. For example, forget about IRQs, just write a program that counts the number of times a knock has happened. It will look something like:
Code: Select all
num_knocks = 0
knock_pin = Pin(5, Pin.IN)
while True:
# Look at the pin value and see if it's changed.
# If it has, add one to the counter and print it out.