What are external Interrupts? - (Arduino Uno Programming for Beginners)

แชร์
ฝัง
  • เผยแพร่เมื่อ 4 ก.ย. 2024

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

  • @gyruss3239
    @gyruss3239 หลายเดือนก่อน

    This is the best channel on TH-cam for Arduino tutorials! You have a knack for teaching this.
    Idea for a future video(?): I'm trying to integrate a TM1637 into my project. While the project is idle, the TM1637 displays a static number. After a button command is given, a motor runs and while the motor is running I'd like the TM1637 to illuminate one segment and make the segment crawl around the display like an hourglass timer. When the motor stops, a static number would again be displayed. I've written the routine that makes the segment crawl around but I'm using delays to accomplish this and of course that delays the rest of the code.

    • @playduino
      @playduino  หลายเดือนก่อน

      Thank you! This sounds like a great application for a timer library or millis() ;)

    • @gyruss3239
      @gyruss3239 หลายเดือนก่อน

      @@playduino Thanks! I'll check out your millis video 🙂

  • @pcbwayluz
    @pcbwayluz 6 หลายเดือนก่อน

    Very detailed and thorough. Were wondering if any of our custom service like PCBs would be helpful in your future projects. Can anyway reach you out?

  • @JasonKoukliatis
    @JasonKoukliatis 7 หลายเดือนก่อน

    Great video and explanation! Two questions if I might. 1. Can you use delay function inside the ISR? 2. Can I have an internal loop inside an ISR so as to do 3 parallel things? (one on main loop and 2 parallel jobs and checks on pins 2 and 3). Finally, can I "share" variables between main loop and ISR functions (volatile maybe or something?). Thanks a lot for the great video.

    • @playduino
      @playduino  7 หลายเดือนก่อน +2

      Thank you for the kind words, 1) no, they are not working. The ISR needs to be quick, so the best thing to do in an ISR is to change a variable and leave the ISR.
      2) unfortunately no. Arduino does not support multitasking. You can only execute one loop at a time.
      The best thing that comes very close to multitasking is to write non-blocking code.
      take a look at my video 15 about millis: th-cam.com/video/FIYjw0AhTkA/w-d-xo.htmlsi=ZCbUe6wDghEty-Xc
      3) yes! it works great with global volatile variables you need to add volatile otherwise you could run into some troubles. You need to define them outside of setup() and loop() usually at the very top of the sketch.

    • @JasonKoukliatis
      @JasonKoukliatis 7 หลายเดือนก่อน

      @@playduino Thank you very much for your prompt reply! I will watch your video right away. Thanks again!

  • @Volker-Dirr
    @Volker-Dirr 8 หลายเดือนก่อน

    Very nice video. Well explained and perfekt view on source and hardware. Just very minor possible improvement: At the end you didn't demonstrated on the hardware, that the other player can't win anymore, since you detached the interrupt.

    • @playduino
      @playduino  8 หลายเดือนก่อน

      Thank you for the nice feedback :) I agree, however both LEDs would have turned on after my test with two fingers

  • @samuelgunter
    @samuelgunter 8 หลายเดือนก่อน +1

    can an interrupt interrupt another interrupt? for example, could the buttons be pressed at the precise time that the other interrupt is triggered to run after one of the lights turn on but before the interrupts are unregistered?

    • @NormanNodDunbar
      @NormanNodDunbar 8 หลายเดือนก่อน +1

      During an interrupt, further interrupts are disabled. You can, if you know what you are doing, enable interrupts in an ISR but it's not recommended.
      Cheers,
      Norm. (Author: Arduino Interrupts published by Apress)

    • @playduino
      @playduino  8 หลายเดือนก่อน +1

      very good question, as @NormanNodDunbar already pointed out, inside the ISR, interrupts are disabled by default.
      if you really need it, you can call the function interrupts() inside of the ISR to enable them, you can also disable them again by calling noInterrupts()

  • @nirvanakh66623
    @nirvanakh66623 8 หลายเดือนก่อน

    Red finger is faster? I think its was green

    • @playduino
      @playduino  8 หลายเดือนก่อน

      Omg 😆 yes