Thanks for this set of M/P tutorials, very useful stuff indeed. This one caught my eye initially but i have since been back and watched the whole set. Well presented, well paced, clearly explained. Well done, Thanks!
Thank you for this series, well explained! While this video shortly touches the possibility of having several interrupt pins, I still don't understand how to actually do this. I have 2 motors and 4 limit switches, so I want each motor to stop moving in a certain direction when it reaches the associated limit switch (movement controlled by a system of 3 relays per motor). Would I need 1 function and 4 irq objects? Or 2 functions? Is there any explanation or tutorial I could follow to understand this better? Thanks a lot!
My guess is that Micropython has a scheduler. Which is how it can make the interrupts' event handlers queue behind each other. The way interrupts work on machine level is much more complicated with priorities etc. Is my guess correct?
im having an issue.. My code is identical to yours.. but before I run it I get this yellow warning error: "Unresolved attribute reference 'irq' for class 'Pin'" then when I run it.. I get an error:"TypeError: can't convert 'int' object to str implicitly" any help? thanks
Hey thanks for the video. I found it while trying to troubleshoot my code. I followed your code, and have it just like yours is at 13:05, minus the sleep timer and with a print statement instead of the led output. Even though I have the handler set to IRQ_RISING it reacts for both rising and falling events. I thought it might be a debouncing issue but it still happens with a SPST switch instead of the tactile momentary switch. There is a debouncing issue still, but the it stops printing after about 5 times. But it does this for both states. I'm running the code on an old Huzzah ESP8266 breakout with micropython v1.17 I'm gonna keep looking but any advice would be appreciated! Thanks!
good morning, I wanted to get the value of the pin that got the interruption. example: def callback (pin_irq): print (pin_irq) result: Pin (14) I need only the value 14 not "Pin (14)" how can I do it?
Hi and thanks for the video. I work with a ESP32 and I can't explain why when I press the button, it happen randomly like multiple presses. I tried to add a 10K resistor OR / AND use the Pin.IN.PULL_UP Pin() parameter. Do you have a idea please? Thanks!
I know your comment is 2 months old but just in case you still haven't solved this, it sounds like you need to look into "debouncing". The issue you're facing is caused by noise, i.e. when you press down on the button, the signal will fluctuate up and down until it settles. Debouncing is a way to deal with this.
Yes and no. Threading is only supported on some MicroPython ports at the moment. In their own documentation about the _thread module, they say: "This module is highly experimental and its API is not yet fully settled and not yet described in this documentation." I think the ESP32 port supports threading. Feel free to play with it. If you find that the threading is not working, you can use timers as an alternative to jumping between two tasks.
Thanks for this set of M/P tutorials, very useful stuff indeed. This one caught my eye initially but i have since been back and watched the whole set. Well presented, well paced, clearly explained. Well done, Thanks!
Nicely done, great simple example of IRQ's, ie Interrupt Request Queue, as I know them. Thanks for your work!
I just found out about your channel and I love it! Thank you so much
Igreat tutorial I am really looking forward started today with micropyton. TY
Interrupt Re Quest idk where you got query from
Thank you for this series, well explained! While this video shortly touches the possibility of having several interrupt pins, I still don't understand how to actually do this. I have 2 motors and 4 limit switches, so I want each motor to stop moving in a certain direction when it reaches the associated limit switch (movement controlled by a system of 3 relays per motor). Would I need 1 function and 4 irq objects? Or 2 functions? Is there any explanation or tutorial I could follow to understand this better? Thanks a lot!
My guess is that Micropython has a scheduler. Which is how it can make the interrupts' event handlers queue behind each other. The way interrupts work on machine level is much more complicated with priorities etc. Is my guess correct?
im having an issue.. My code is identical to yours.. but before I run it I get this yellow warning error: "Unresolved attribute reference 'irq' for class 'Pin'"
then when I run it.. I get an error:"TypeError: can't convert 'int' object to str implicitly"
any help? thanks
Hey thanks for the video. I found it while trying to troubleshoot my code. I followed your code, and have it just like yours is at 13:05, minus the sleep timer and with a print statement instead of the led output. Even though I have the handler set to IRQ_RISING it reacts for both rising and falling events. I thought it might be a debouncing issue but it still happens with a SPST switch instead of the tactile momentary switch. There is a debouncing issue still, but the it stops printing after about 5 times. But it does this for both states.
I'm running the code on an old Huzzah ESP8266 breakout with micropython v1.17
I'm gonna keep looking but any advice would be appreciated! Thanks!
How do I do long press ? Maybe I want the LED to turn on when I click the button and when I hold the button the LED should turn off.
good morning,
I wanted to get the value of the pin that got the interruption.
example:
def callback (pin_irq):
print (pin_irq)
result:
Pin (14)
I need only the value 14 not "Pin (14)"
how can I do it?
i have a M5stack board. so, i want to create a event for textbox or create eventhandl, how do you do?
Why my led stays On even when i release the btn. ?
Hi and thanks for the video. I work with a ESP32 and I can't explain why when I press the button, it happen randomly like multiple presses. I tried to add a 10K resistor OR / AND use the Pin.IN.PULL_UP Pin() parameter. Do you have a idea please? Thanks!
I know your comment is 2 months old but just in case you still haven't solved this, it sounds like you need to look into "debouncing". The issue you're facing is caused by noise, i.e. when you press down on the button, the signal will fluctuate up and down until it settles. Debouncing is a way to deal with this.
Thanks I agree with you, I will try to play with a debounce timer.
Can you make a video on using ESP-CAM with Micropython?!
Why doesn't this require a while loop?
no irq function...
It's possible to use threadding with MycroPython? To listen interrupts and execute at the same time. Thanks...
Yes and no. Threading is only supported on some MicroPython ports at the moment.
In their own documentation about the _thread module, they say:
"This module is highly experimental and its API is not yet fully settled and not yet described in this documentation."
I think the ESP32 port supports threading. Feel free to play with it. If you find that the threading is not working, you can use timers as an alternative to jumping between two tasks.
Nice but almost unwatchable. You have a very annoying fan running through the whole video.