Learn MicroPython #4 - Interrupts (event-driven code)

แชร์
ฝัง
  • เผยแพร่เมื่อ 27 ส.ค. 2024

ความคิดเห็น • 22

  • @capiberra4118
    @capiberra4118 4 ปีที่แล้ว +3

    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!

  • @bgable7707
    @bgable7707 3 ปีที่แล้ว +1

    Nicely done, great simple example of IRQ's, ie Interrupt Request Queue, as I know them. Thanks for your work!

  • @josseman
    @josseman 3 ปีที่แล้ว

    I just found out about your channel and I love it! Thank you so much

  • @davidmarks509
    @davidmarks509 2 ปีที่แล้ว

    Igreat tutorial I am really looking forward started today with micropyton. TY

  • @IRBry
    @IRBry ปีที่แล้ว

    Interrupt Re Quest idk where you got query from

  • @annasarahkramerfazendeiro8030
    @annasarahkramerfazendeiro8030 4 ปีที่แล้ว

    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!

  • @Kasslim11
    @Kasslim11 4 ปีที่แล้ว

    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?

  • @elliot1784
    @elliot1784 4 ปีที่แล้ว

    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

  • @ThalassTKynn
    @ThalassTKynn 2 ปีที่แล้ว

    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!

  • @minecraftteddy99
    @minecraftteddy99 5 ปีที่แล้ว

    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.

  • @ta77o
    @ta77o 5 ปีที่แล้ว

    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?

  • @Huynh-Tan-Quoc
    @Huynh-Tan-Quoc 4 ปีที่แล้ว

    i have a M5stack board. so, i want to create a event for textbox or create eventhandl, how do you do?

  • @sergiomoranavarrete9426
    @sergiomoranavarrete9426 3 ปีที่แล้ว

    Why my led stays On even when i release the btn. ?

  • @thepierced
    @thepierced 5 ปีที่แล้ว

    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!

    • @HHashi
      @HHashi 4 ปีที่แล้ว +2

      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.

    • @thepierced
      @thepierced 4 ปีที่แล้ว +1

      Thanks I agree with you, I will try to play with a debounce timer.

  • @freddymac128
    @freddymac128 3 ปีที่แล้ว

    Can you make a video on using ESP-CAM with Micropython?!

  • @anthonyanderson2752
    @anthonyanderson2752 4 ปีที่แล้ว

    Why doesn't this require a while loop?

  • @GmanBB
    @GmanBB 4 ปีที่แล้ว

    no irq function...

  • @mrem8804
    @mrem8804 5 ปีที่แล้ว +1

    It's possible to use threadding with MycroPython? To listen interrupts and execute at the same time. Thanks...

    • @inventboxtutorials1898
      @inventboxtutorials1898  5 ปีที่แล้ว

      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.

  • @ec92009y
    @ec92009y 3 ปีที่แล้ว +2

    Nice but almost unwatchable. You have a very annoying fan running through the whole video.