How to Use Arduino Interrupts The Easy Way

Поділитися
Вставка
  • Опубліковано 1 жов 2024

КОМЕНТАРІ • 222

  • @ScreamingTurtleRacing
    @ScreamingTurtleRacing 8 місяців тому +15

    Easily the best Arduino tutorials I’ve seen on UA-cam. I came for the interrupts, but I will definitely be watching more. A refreshing change from the usual content. Thank you!

  • @ZothiamaCF
    @ZothiamaCF 7 місяців тому +18

    5 minutes in to the video and I've already clicked the subscribe and like buttons. This is how all tutorials should be made. You are a most awesome teacher.

    • @Nemecys
      @Nemecys 5 місяців тому

      Exactly what this guy said - sooooooooooo beautifully explained :)

    • @danielb8197
      @danielb8197 4 місяці тому

      ditto

    • @Perfectflight-i3f
      @Perfectflight-i3f 3 місяці тому

      For real :)

  • @jdoedoenet
    @jdoedoenet 8 місяців тому +11

    You are one fantastic teacher! I am a former HP engineer (long ago!) and have finally reached a place in life where I can do this sort of thing just for fun.
    Your videos are immensely helpful and entertaining to boot. Absolute goldmine.
    Thanks for all that you do!

  • @nexpro6985
    @nexpro6985 9 місяців тому +4

    Pretty good explanation of ISR, thanks.
    Maybe the pin names should be constants not variables. They are not going to change.
    const int BLUE_LED = 11;
    LOW and HI are constants also hence uppercase.

    • @ABaumstumpf
      @ABaumstumpf 8 місяців тому

      "LOW and HI are constants also hence uppercase."
      Kinda,... not... they are defines.

  • @edgarbonet1
    @edgarbonet1 4 місяці тому +4

    Very nice tutorial! I would just suggest a few corrections:
    1. The Arduino Uno has no software interrupts, although they can be simulated by writing to an interrupt pin configured as output. The timers are hardware devices, and the timer interrupts are hardware interrupts.
    2. The first parameter of attachInterrupt() is an “external interrupt” number. This is not the same as an interrupt vector number. FWIW, external interrupt number 0 is interrupt vector 2 (see the ATmega328P datasheet).
    3. Only variables shared between ISR and regular code need to be volatile. In the example you give, buttonState should be local to the ISR, and doesn't need to be volatile.
    4. Using millis() within an ISR is perfectly fine. You should not, however, expect millis() to get updated within the ISR, as it gets “frozen” when the interrupt is triggered.

  • @miachristensen5444
    @miachristensen5444 9 місяців тому +9

    This is so incredibly easy to understand and paced at such a great rate! Thanks for the amazing video! Can't wait to learn more from you =)

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  9 місяців тому +2

      Glad it was helpful! Let me know if you want me to cover any topics and I'll put it in rotation.

  • @tb303wpf1
    @tb303wpf1 4 місяці тому +1

    Thank you so much for this video! I had buttons on pins that were not hardware interrupts and I woumd up modifying my code in some very creative ways to simulate hardware interrupts. It worked pretty good too. Lol.
    Now I will remove all of that erroneous code and move the buttons to the hardware pins.
    I feel like such an idiot. 🤣

  • @jtodora
    @jtodora 7 місяців тому +3

    EXCELLENT description of using interrupts. Very Good!!!

  • @nawnifari
    @nawnifari Рік тому +3

    Cool.. arduino beginner should watch this.. I'm sharing it to classmate..

  • @aardito215
    @aardito215 10 місяців тому +4

    Great video, you explained this so well! I've spent hours looking at other videos on timers and interrupts which just confused me. I'm just getting back into Arduino programming after a 5-year break, and this was a huge help with the project I'm working on.

  • @PammyStevensonEquest
    @PammyStevensonEquest 9 місяців тому +3

    Great video. Might be worth mentioning a while loop with small 1ms delay as a non interrupt solution on the way to the interrupt solution. Also an internal timer is a hardware interrupt, software interrupts are generated directly by the microprocessor when it needs system tasks done - memory management, errors, crashes, etc

  • @sanJorgeRM
    @sanJorgeRM Рік тому +3

    Very usefull explanations! Ty very much. Blessings from Spain 🇪🇸

  • @paulmcmahon7899
    @paulmcmahon7899 8 місяців тому +1

    Thank you for this. My project involves LaRa radios remotely located, so this is a big boost in being able to run the remote processes while waiting to receive a transmission.
    One difference from your video. When I run your sketch, exactly copied, RED flashes four times, the BLUE flashes, but twice, in opposite synch to RED. Then red flashes twice more, then blue-red twice, etc. I've played with the delay and the microseonds. Seems as though the ISR runs twice every 1/10 second. I'd like to test LoRa for data receipt in the interrupt and do pass the incoming data to the loop. It may not matter, but thought I'd ask since my results differ. Thank you again.

  • @JumbleLane
    @JumbleLane 8 місяців тому +3

    This is brilliant, for a 65 year old to finally understand how interupts work. Your upbeat way of describing how it works is just fantastic. I can now implement this in a few of my projects and also see if I can find information on doing a similar thing with the ESP32 to improve some of those projects. Thanks Rachel, I will certainly go through your videos and also subscribe. Regards, Geoff.

  • @georgejetson4378
    @georgejetson4378 8 місяців тому +1

    Great content and thank you for posting. I’m just getting started with Arduino so your posts are very timely but I’m wondering why you declared buttonState variable inside of loop. I was taught to only declare variables once otherwise the processor wastes resources. I think your code would still work if you declared before the loop. Do you agree?😊

  • @insoft_uk
    @insoft_uk 9 місяців тому +1

    I would recommend when using such things as == LOW reverse it so LOW ==
    as it prevents mistakes like single = getting missed as a “var = const” will compile yet “const = var” will fail and you will pickup on the missing =

  • @kentharris7427
    @kentharris7427 7 місяців тому +2

    I built a demonstration of a perpetual motion machine as my first project using an Arduino. "Perpetual Motion Machine?" The Arduino is very flexible and can even work with a power supply that is a half bridge rectifier. Looking forward to your next video.

  • @oscareriksson9414
    @oscareriksson9414 9 місяців тому +3

    Really good, straight to the point and simple. Exactly what I need for my projects

  • @shirleysharrock7204
    @shirleysharrock7204 9 місяців тому +4

    Your descriptions are clear and enjoyable to watch. I didn’t yawn at all and no urge to nap which is common with the monotone streams I have endured. Showing the pitfalls and showing the process . Thank you for your stream.

  • @kiranvsutar5980
    @kiranvsutar5980 8 місяців тому +1

    Thanks for such an informative session. This video really helped me to take out the fear of using Interrupts.
    However, I have a question:
    If the Timer 0 interrupt is used....I should NOT be using delay or millis functions......but if I am using Timer 1 or Timer 2 .....can I use delay and/or millis in the loop function?

  • @snakezdewiggle6084
    @snakezdewiggle6084 9 місяців тому +1

    Global Declaration
    int MySecs = 1000000;
    ...
    ...
    Delay (MySecs x 1.5) ;

  • @75mechanic
    @75mechanic 8 місяців тому +1

    Wow great video. Well presented. Easy to understand.
    Learning arduino and found this excellent.

  • @charlesspringer4709
    @charlesspringer4709 8 місяців тому

    Just for kicks. First method. void buttonInterrupt() digitalWrite(blueLED, !digitalRead(buttonPin));

  • @dsbohra
    @dsbohra 19 днів тому

    HI Rachel, would you please explain why BLUE LED keeps blinking after uploading your code at 5:14? I made it on Wokwi and on actual Arduino, both have a mild blinking effect. Thanks.

  • @zuzukouzina-original
    @zuzukouzina-original 7 місяців тому +1

    You have a gift to explain it very clear and simple. Thank you 🙏🏼

  • @cadillacescalade5428
    @cadillacescalade5428 6 місяців тому

    Hi, Good Afternoon I am New to arduino and I am trying to put a sketch together by using a servo at 0 to 60 and use a IR sensor to activate it and also use a sound file or DF-Mini player for sound.
    Could you please help me with it ?

  • @daviddossor6711
    @daviddossor6711 Місяць тому

    !!!! Thank you. !!!! As you would say I now have no hair left after a day that I spent trying to get 3 led's to blink with one at a different rate....
    They did blink but not to the timings I set no matter what I did or how I rewrote the sketch..... They were very random at best no matter what I did..... I definitely failed the class and was at the bottom of the grade... """" Interrupts"""" nice stuff.!!!!!! After watching you video multiple times and taking lot's of notes for later Ron....
    My sketch now works as intended and I'm now a solid "'" A "" student....
    To a dumb bum you are a angel , a little crazy but an absolute angel ,,, !!!!!!! Thank you.!!!!!!!

  • @ethzero
    @ethzero 8 місяців тому

    13:00 Regarding where to put additional functions in code, it's true that for the Arduino IDE+Compiler top or bottom is fine.
    However, if you're using an ESP32+Arduino Framework+PlatformIO+VScode I've found that (probably) the compiler complains about "undeclared functions" if you put them at the end, i.e. you try to call on a named function before it's seen in the code.
    There might be an additional parameter or something that can be parsed to the compiler, but that beyond me.

  • @TheJohndeere466
    @TheJohndeere466 День тому

    Is there a way to make an arduino close a circuit. The circuit will have a very very low current draw. I just need the arduino to close the circuit just like you would press a little button. I know you can make the arduino trigger a relay but is there a way to close a circuit without an external relay.

  • @murugesh9338
    @murugesh9338 6 місяців тому

    Your video is amazingly clear. thanks for the effort Rachel. Timers works in UNO but not in ESP boards. can you please suggest some library like the same that workks with esp32 boards?

  • @bikkies
    @bikkies 8 місяців тому

    This is really excellent. I have recently decided to do something with the Uno I bought mumblety years ago, and the billion others (also Nanos, Pro Micros, Megas and more) that I've hoarded over the last month. My electronics knowledge is rudimentary at best and, though I started my IT career 40*mumblety years ago as a programmer, I was never much good at coding. That's why I moved towards support, networking and my beloved UNIX. It's time for me to get back into writing crap code again and this is the sort of video I need to help me do that.
    Now all I need to do is find out how to make my Arduinos speak COMAL or Pascal. No? No :( bah.

  • @columbiabuzz
    @columbiabuzz 3 місяці тому

    Thankyou darling: this the first time I've heard about Timer1. Many examples call to timer1 when there's no evidence where it came from. Obviously, it was in the library file, but I didn't know why everyone uses TimerOne the file name, but the code is calling Timer1. It must be imbedded in the library, but it wasn't obvious to me. First I heard about 3 timers also.

  • @indikaudayasaranga988
    @indikaudayasaranga988 10 місяців тому +1

    Your knowledge is excellent. Thank you for sharing. Big Hats off.

  • @liszcgsedt
    @liszcgsedt 8 місяців тому

    I am wondering, can in this (interrupts) instance the blue led stay HIGH, while the red one keeps blinking (that is as with a latching switch or a longer delay on the blue led)?
    In my specific case, I am thinking of a simple buzzer piano for my nephew. Overingeneering as usual, I got this idea of having a song or predefined beats playing from one buzzer, while being able to play tones on the other buzzer by pressing keys. Already binge-researching and I certainly will need to do some partia demos to try the concept first, but if anyone has an idea to save me some dead ends...
    OMG, on additional hough, I may actually replace the key buttons qwith piezo touch sensors and possibly add a small amp (which have a couple of) to add an audio jack output. I really need to define an MVP to start with. :D

  • @home_Grown_studio
    @home_Grown_studio 8 місяців тому

    I did it with the LEDs flashing in binary with a string of code. I was attempting to create an effect similar as seen on Close Encounters of the Third Kind with Richard Dreyfuss . Most of you may not be familiar with the movie depending on your age. It was an attempt at communication with the Alien spaceship. I was not successful I could not recreate the sound frequency for each LED. as per the movie. I was having fun with LEDs, Relays, piezo speakers,

  • @peterkowald7092
    @peterkowald7092 5 місяців тому

    So you asked has anyone ever written a multitasking function without using interrupts, and the answer is yes. I developed a cooperative multitasking core for any microcontroller after has a system that was doing a ton of work and struggling to get all done within a second. It took me a good while thinking about the problem before I developed the engine (it’s very very light weight and consumes only a few hundred bytes of memory. That same system doing all the same things (and now more) runs at around 15,500 cycles a second.
    I have now been using it for several years and use it on very project as it eliminated more code than it uses. In fact I even use it on top of RTOS because make coding do easy. So yo answer your question .. Yes
    I use it commercially so I won’t release it, sadly but I have a significant competitive edge killing systems with bigger, faster and more expensive microcontrollers.
    Nice bright video for beginners

  • @generessler6282
    @generessler6282 8 місяців тому

    Very good. Great explanations. But this is different from any use of the term "software interrupt" I've ever seen. Normally that refers to a processor instruction that invokes the same state save protocol as a hardware interrupt a la the x86 INT instruction. It's e.g. used to invoke OS functions. Timer interrupts are hardware. It's just that the hardware is on-board rather than external.

  • @tenfriskydingos
    @tenfriskydingos 7 місяців тому

    Awesome video thanks! Ive been having trouble reading the pulses from an old school rotary dialer using just debouncing, I think this will do the trick for me though!

  • @PeetHobby
    @PeetHobby 8 місяців тому

    Multitasking without interrupts can be achieved using a system tick and tasks that you call after a sustained number of system ticks.

  • @guidovlaere
    @guidovlaere 9 місяців тому +1

    Thanks from the Netherlands 🇳🇱 for your super tutorial! Your videos are very helpfull! 😊

  • @danny117hd
    @danny117hd 8 місяців тому

    I'm using I guess timer0. I maintain a sorted array of millis. If it's past that millis it executes changes else leave the loop. Drawback is it fails after 39 days or something like that.

  • @zentriceggofficial
    @zentriceggofficial 3 місяці тому

    You'd get rid of the delay function and replace with millis() to make it fast without interrupts. 😊

  • @MrScaryLemonHead
    @MrScaryLemonHead 8 місяців тому

    I have a sketch for a miniature fortune teller. I have all sorts of stuff occurring. Yet, as soon as I add flickering LEDs to the code… the code goes to crap.

  • @HaulahTebazaalwa
    @HaulahTebazaalwa 6 місяців тому +2

    The world's best Queen teacher thanks

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  6 місяців тому

      Glad you enjoyed it! Let me know if there's any topics you'd like me to cover.

  • @ammarlokhandwala2858
    @ammarlokhandwala2858 4 місяці тому

    Hello there, I was just wondering if we can assign other pins appart from 2 and 3 in arduino uno for interrupt, if we are using digitalpintointerrupt function?

  • @emmamarx9284
    @emmamarx9284 29 днів тому

    You are such a good teacher!!! This made interrupts so much easier to grasp, thank youuuuuu❤

  • @jorgelima5695
    @jorgelima5695 9 місяців тому +6

    In the hardware interrupt example, the buttonState doesn't need to be global and doesn't need to be declared as volatile because the first thing the interrupt handler does is to assign it to the return value of digitalRead() and the variable is not accessed anywhere else in the program.

    • @Math2C
      @Math2C Місяць тому

      Where do you learn this stuff?

  • @hz.maverick
    @hz.maverick 16 днів тому

    this is the best tutorial i`ve seen in a while! thank you very much for sharing!

  • @Ducerobot
    @Ducerobot 8 місяців тому

    I have to get back to robotics I've been slacking . Maybe this can get me off the couch.

  • @devrimarabalari
    @devrimarabalari 8 місяців тому

    Wow, India Summer knows how to program Arduino.

  • @arturosanvicente
    @arturosanvicente 22 дні тому

    Heyy Rachel I saw you on TV in a car repair program!!!!

  • @aaronfrye1195
    @aaronfrye1195 10 місяців тому +1

    Thank you for this very inspiring and informative video.

  • @zz3709
    @zz3709 8 місяців тому

    Great explanation, how about serial receive interrupts?

  • @Witsenburg
    @Witsenburg 6 місяців тому

    I've used millis functions to multitask up to now. What would be the faster way? I'm working on an IR sensor changing state every 0,007 seconds, I need to be fast...

    • @edgarbonet1
      @edgarbonet1 4 місяці тому

      7 ms is not fast. For such slow things, multitasking with millis() (or micros() for better granularity) should work fine.

  • @surenbono6063
    @surenbono6063 11 місяців тому +1

    ..i like the flow of this tuturial...its like a sketch itself...it delivers you from darkness to light...

  • @michaelc1063
    @michaelc1063 День тому

    How can I use an Interrupt to exit void loop?

  • @8867348
    @8867348 9 місяців тому +1

    Wow, you are so much fun. I don't know how far I will get with this arduino stuff. I'm 52 and originally just wanted to build an led cube but somehow got off into this coding. It's very interesting but having a difficult time retaining what I learn. I don't get to spend as much time on it as I would like to. You did a very good job explaining in your video and I completely understand but, 3 days from now I'll be like "how did that lady do that?". Lol, maybe I'm getting in over my head.

    • @arliewinters2776
      @arliewinters2776 6 місяців тому +1

      I'm 64....Not as on-point as I used to be. I've found just reading about it is not enough for me.... "doing it" keeps it fresh in my mind.

  • @lebigamine9916
    @lebigamine9916 9 місяців тому

    You are just supercalifragilisticexpialidosious.

  • @jbarragan
    @jbarragan 8 місяців тому

    It's a funny way to understand interrupt process.

  • @ProfessorOzone
    @ProfessorOzone 3 місяці тому

    As I watched this video, I thought to myself, I know this person from somewhere, but from where? So I googled and OF COURSE, it was All Girls Garage! I'm a car guy too. I don't know how a marketing person gets into Arduino code, but I'm really glad you did because you explained it in a way I can understand. What I'm doing is simple and you explained very nicely how to do it simply. Thank you for this.

  • @spudnickuk
    @spudnickuk 8 місяців тому

    I have not long understood about using Millis instead of delay
    I have a question to ask
    If I have power to the Arduino
    And have a code programed installed
    Can I use a button to activate the code
    Meaning the code is dormant untill I press a button
    What I'm doing at the moment is have two LEDs blink via the Millis timing
    But it runs all the time so I have a button that is used as a circuit breaker and so when I press it it makes the leds connect
    But I would like to understand is there a way how to use a button to run the code to activate the LEDs only when the button is pressed

    • @Klimafutzi
      @Klimafutzi 2 місяці тому +1

      There is a "sleep mode" you can use for this.
      In this mode the Arduino consumes only very less power, so this is great to be used on battery powered solutions.
      From this sleep mode the Arduino can get waked up by timer or button, as you like.
      Then the Arduino can do it's job and fall to sleep again.

  • @MizzardNet7Net7
    @MizzardNet7Net7 7 місяців тому

    It's much easier to write: digitalWrite(blueLED, digitalRead(buttonPin));

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  7 місяців тому +1

      Indeed! That definitely saves some lines of code! 👍

  • @kennysmart8273
    @kennysmart8273 2 місяці тому

    @ Rachel De Barros, how can I use this for multiple blinking lights, say like the strobe lights on an aircraft, if I wanted to put this on a model I need them to go on in one colour then off & onto another colour, there’s 3 colours I need to use red, white & green. The white light would be constantly on too. Any help or advice would be greatly appreciated.

    • @Klimafutzi
      @Klimafutzi 2 місяці тому

      Don't know, whether you still need an answer...
      Here is my suggestion.
      I would implement a timer counter with a counting speed of the smallest time slice you need, say it is 100 milli seconds. So on each timer interrupt increase the counter by one. Then think of a state machine where at distinct count values things should be done.
      For example red LED every 300 milli seconds (ms), green LED every 500 ms and blue LED every 700 ms.
      Then the counter has to count up to the smallest common multiple. In our case this is 3 * 5 * 7 = 105. If the counter reaches this value set it back to zero. Within ISR:
      Counter = Counter + 1;
      If Counter >= 105 {
      Counter= 0;
      }
      To toggle the red led use the following if statement:
      If ( (counter % 3) == 0) {
      ToggleRedLed();
      }
      For the green LED exchange 3 by 5 and call
      ToggleGreenLed():
      If ( (counter % 5) == 0) {
      ToggleGreenLed();
      }
      For the blue LED exchange 3 by 7 and call
      ToggleBlueLed()
      The % is the so-called modulo operator:
      0 % 3 = 0
      1 % 3 = 1
      2 % 3 = 2
      3 % 3 = 0
      4 % 3 = 1
      5 % 3 = 2
      6 % 3 = 0
      ....
      And so on
      X % n will always compute to values from 0 to n-1 (for X >= 0)

  • @nityamaheshwari8259
    @nityamaheshwari8259 9 місяців тому +1

    i watch so may videos on google related to interrupt , but your lecture is amazing, i understand all the concept very clearythanku so much , for a grt video😁😁

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  9 місяців тому

      Glad you enjoyed it! Let me know if you want to see any other topics.

  • @mikefochtman7164
    @mikefochtman7164 8 місяців тому

    Just a small comment @16:14. In this case, you only use 'buttonState' within the ISR, so it could be left local to that and wouldn't need the keyword 'volitile'. The only time this variable is changing is the line with 'digitalRead(buttonPin)' and that's only called in the ISR.
    An example where you would want it declared outside the ISR and WITH the keyword 'volitile' would be if it's changed inside the ISR (via that call to 'digitalRead(buttonPin)') and then used OUTSIDE of the ISR, (perhaps in 'loop()'). The compiler has no way of 'knowing' when the ISR may be triggered to change 'buttonState' so in loop() it must check the value in memory each and every time.

  • @ChaplainDaveSparks
    @ChaplainDaveSparks 5 місяців тому

    I love this video for two different reasons:
    I haven’t programmed interrupts in ages. If I’m not mistaken, it was on a Z-80 back in the 80s.
    Rachel reminds me so much of someone we lost, also in the 80s: *_Karen Carpenter!_* Similar voice, facial expressions, and body language.

  • @andreabotti9444
    @andreabotti9444 8 місяців тому +2

    sta battona

  • @soumenbanerjee4389
    @soumenbanerjee4389 8 місяців тому

    Why you are using old age IDE and why not CLION + PlatformIO ??

    • @siddharthvalentine4933
      @siddharthvalentine4933 4 місяці тому

      Bcz compiler is crazy in the new version u have to be very very precise to write code in it

  • @valrach7303
    @valrach7303 8 місяців тому

    i am not a native english speaker.. i kind of have a hard time understanding various dialects..so, dear mam..THANK YOU!!! Its literally the first video I can understand 😭
    I am missing out a lot in school due to mental health reasons and I try to relearn all the stuff so i wont fall behind

  • @rayleblanc7209
    @rayleblanc7209 9 місяців тому

    I remote controlled a 10 HP Craftsman track drive snow blower using a 10 channel Flysky and mega 2560. I learned Arduino coding just to build the project. I use all 10 channels to operate the servos, motors and actuators. I was able to get everything to work without using any interrupts. I'm sure my code is far from perfect, but surprisingly I got everything to function.

  • @terrybest3036
    @terrybest3036 8 місяців тому

    Question: Is the interrupt routine being called twice each press since you used "change"? The pin is pulled up, then you press the button so it goes low and the interrupt gets called. When you release the button, is that also another change to high so it gets called again?

    • @Klimafutzi
      @Klimafutzi 2 місяці тому

      Yes, you are right.
      There will be an interrupt for each state change.
      One interrupt on changing from HIGH to LOW and another on changing back from LOW to HIGH.

  • @rhandynastor4866
    @rhandynastor4866 Рік тому +1

    thanks for this. Very nice explanation

  • @tonyparakka4038
    @tonyparakka4038 2 місяці тому

    Thank you! So nicely explained!

  • @hamradio3716
    @hamradio3716 7 місяців тому

    Wow, what a great teacher. So enthusiastic!. Good examples. Now I can fix some broken ISRs that use sleep.

  • @Richardson_Valakyr
    @Richardson_Valakyr 5 місяців тому

    Im learning english and also Arduino... i found both here you are amazing... Thanks!!!!

  • @williamburns7336
    @williamburns7336 11 місяців тому +1

    I JUST FOUND YOU TODAY AND LOVED YOUR VIDEO. LEARNING CAN BE BORING, BUT NOT IN YOUR VIDEOS. I'M REQUESTING MORE CODING VIDEOS, YOU HAVE TWO, AND I SEE YOU PLAY THE VIOLIN , I HAVE ONE I HAVEN'T LEARNED TO PLAY YET. JUST A COUPLE OF SUGGESTIONS, THANK YOU WILLIAM

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  11 місяців тому

      Thanks so much for the suggestions! Yep - I have more coding videos coming - mostly Arduino and coding for robots/animatronics projects. I hope you pick up the violin soon!

    • @BariumCobaltNitrog3n
      @BariumCobaltNitrog3n 9 місяців тому

      No need to shout.

  • @KenanYusufTemel
    @KenanYusufTemel 3 місяці тому

    You are well prepared, so good at teaching and fun to watch. Thank you for making it possible to watch without getting bored.

  • @jackkylejr.1112
    @jackkylejr.1112 9 місяців тому

    I have two water level switches on a aquaculture food system. The top switch tells when the thank is full and the water pump should turn off. And the bottom switch tells when the tank is empty and the pump should turn on. But I don't know how to code for to hardware switches that are in concert with each other???? Can arduino do this??

  • @prakashbabar3647
    @prakashbabar3647 10 місяців тому

    Great video explanation was such that an idiot can understand. can you explain as I am using millis in one of project where I am using attiny84, and I want to make the current millis zero which I am not able do. also if I can use the interrupt for the same.

  • @antoniopavanetto9891
    @antoniopavanetto9891 8 місяців тому

    Excellent indeed! I've suffered while you hot swap the connections.😅

  • @autotuneengineering
    @autotuneengineering 10 місяців тому +1

    Great video!, thank you .

  • @AmosNistrian
    @AmosNistrian 8 місяців тому

    Good video. I think your next video should be interrupts based on serial read messages, like if that button was on a touch screen.

  • @sennabullet
    @sennabullet 5 місяців тому

    Thank you for this video. I really appreciate your enthusiasm!

  • @grk608
    @grk608 8 місяців тому

    Hi Rachel, if I join your website for $4.99 per month, am I able to send you some code that I wrote that I'm having an issue with? Simply put, I'm using two Nano's, two HC05 bluetooth modules, an LED, a relay, a button, and a reed switch. When I press the button on the SLAVE device, the relay on the MASTER closes. Does exactly what it's supposed to do. When I open the reed switch (garage door opens) the LED on the SLAVE device lights up as it should. However, while the reed switch is open the button either no longer works, or works really flakey. I followed the directions on this video and really hosed my code. So in short, would this be something you could help with? I'm be happy to join if you could. You're an excellent instructor and I feel like I could learn a lot from you. Thanks in advance. -Glenn

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  7 місяців тому +1

      Hi Glenn, you can absolutely post code in the Discord community. While I can't guarantee that we'll solve your problem, we can definitely brainstorm some ideas as to what's going on.
      You also have the option of joining for free as an "Apprentice" on my website. UA-cam does not allow free tiers so only the paid tier shows up here. You'll be emailed an invite link to the Discord community where you can post code and chat with other members.
      The Founding Members tier (for $4.99/month) includes Live Workshops and Zoom Community Builds.
      To join (either for free or paid): racheldebarros.com/community
      You can toggle between the 2 tiers and pick the one you want 😄

    • @grk608
      @grk608 7 місяців тому

      @RachelDeBarrosLive Thanks Rachel. I joined the paid one so I can get it all. I watched some of your videos and I'm impressed. Thanks again.

  • @hicl5450
    @hicl5450 9 місяців тому

    Thanks for the video. May I know for button interrupt, what if the button is kept to be pressed, is there any way to disable the interrupt and warn the user to release the button, then re-install the interrupt again?

  • @anthonysullivan851
    @anthonysullivan851 6 місяців тому

    I have to confirm previous comments, you are a great teacher and the best and demonstrating Arduino IDE.

  • @dougcox835
    @dougcox835 9 місяців тому

    I have multiple routines that are called from the main loop which are selected by a mode variable. The interrupt works to change that mode variable but it still has to return to the main loop in order to take the next action. I would love it to just break off from whatever it was doing and back to the main loop. At least the button push registers and can be depended on. I just have to wait for the current sub to finish. I could have each sub check for a change in mode and bail but that's messy because every routing would need the same treatment. If I want to do that I might as well have each routing check the button inside the loops.

  • @jacobpilegaard9196
    @jacobpilegaard9196 8 місяців тому

    Great video - thank you very much

  • @davidgorman2665
    @davidgorman2665 Місяць тому

    I found you searching for interrupts. Really enjoyed your video and the way you delivered the information. I can't say I enjoyed any others more. I struggled with button debounce using the hardware interrupt approach, but finally worked through the issues. I look forward to your other videos.

    • @davidgorman2665
      @davidgorman2665 Місяць тому

      Ps: I get page not found when I try to follow your link. Probably because you have move on.

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  Місяць тому

      Thanks for letting me know about the dead link. I re-organized my tutorials on my website and the url must have changed. I corrected it so you can now see the page with the code! 👍

  • @bullitthead7853
    @bullitthead7853 9 місяців тому

    I'm new to arduino and programming. I thought that this video was fantastic, thank you. Liked and subscribed!

  • @joemechanic2751
    @joemechanic2751 4 місяці тому

    I'm new to Arduino but not new to programming, so I'm glad I found this channel. Most other sites for Arduino channels for newbies assume you know zero about programming and are unwatchable.

  • @andybp840c
    @andybp840c 8 місяців тому

    I almost want to duplicate the previous comment excellent explanation so pleased I found this channel
    Thank you

  • @jaynewman6420
    @jaynewman6420 8 місяців тому

    I agree with the ones saying that you are a great instructor. I'm also retired, but I'm making and programming robots.

  • @ABaumstumpf
    @ABaumstumpf 8 місяців тому

    doing the digitalRead for the digitalWrite to toggle the state - yeah that works but... ok, fine.
    Just having a state-variable would be nice, or use the already existing state: the arduino already has to know what state the PIN is in cause that is used directly by the hardware. And you can also read that state directly.
    For these simple tutorials the cost of a single digitalRead is not much and can be ignored, but if you had say 10 LEDs and wanted to blink them to get a dimming-effect than the delay quickly adds up (I think it was 4us for a read - with 10 LEDs that would addup to 80us/cycle - wich ends up in the audio-range. So if anything else is connected that has some mechanical movement this would not be good.)

    • @Klimafutzi
      @Klimafutzi 2 місяці тому

      For dimming LEDs you should use PWM (Pulse Width Modulation). This is done by hardware internally und you do not need to switch LEDs on or off via port writing.

    • @ABaumstumpf
      @ABaumstumpf 2 місяці тому

      @@Klimafutzi "This is done by hardware internally und you do not need to switch LEDs on or off via port writing."
      kinda. With just the "normal" library and simple tutorial ways you can run 6 channels and all timers are used.
      those timers are just periodically running the code that is writing to the port - a nice convenience wrapper for simple applications.
      If you want to control more than 2-3 PWN or """analog""" signals one should look into timer libraries and Atmega timers.

  • @rjm842
    @rjm842 8 місяців тому

    Thank you for this very, very helpful tutorial! it wooooorrrrrrrkkkssssss :)

  • @ms070965
    @ms070965 5 місяців тому

    Very Well explained. Thx a lot

  • @DBB-KE5DUO
    @DBB-KE5DUO Рік тому +1

    Which method is better? (hardware vs software) 🤷🏻
    [or do you answer that later?]

    • @RachelDeBarrosLive
      @RachelDeBarrosLive  Рік тому +3

      Both methods work great - it depends on your project. If you want something to happen repeatedly at a specific interval then a software interrupt is probably best. If the interrupt depends on something external like a button push or if a sensor reading is supposed to trigger something, then a hardware interrupt is the way to go.
      That's a great point about covering use cases and which interrupts would work best for what scenarios. I'll think up some scenarios and update the description here and blog post in the tutorials section of my website! 😄

    • @lagossmartmeterhackathonte8928
      @lagossmartmeterhackathonte8928 11 місяців тому +1

      Hardware interrupt responds to signal from outside and software interrupt can be used to generate predefined time interval for an event etc.

  • @ahmedsoussi2171
    @ahmedsoussi2171 Місяць тому

    Well explained. Thanks a lot

  • @MikelGarin999
    @MikelGarin999 8 місяців тому

    Thank you! I didn't know TimerOne library and its ease use! I think i could use it on a 16 steps MIDI sequencer i have built! Can it be used in combination with hardware interruptions? I need two hardware interrupts to control the state os two buttons.

    • @Klimafutzi
      @Klimafutzi 2 місяці тому +1

      For a midi sequencer I assume you need serial interface communication.
      I am rather sure, that you could use interrupts for this interface for RX and TX as well on top of the two button interrupts.
      Since the midi timing is critical you should minimize the code within the ISR of the button code.

    • @MikelGarin999
      @MikelGarin999 2 місяці тому

      @@Klimafutzi Thank you! I have used a OR gates combination in order to detect whether any boton out of the 16 the interface contains was pushed. The last gate output is connected to pin 2 (INT0)

  • @grahamnichols1416
    @grahamnichols1416 8 місяців тому

    Great video. Rachel's infectious enthusiasm had me hitting subscribe right away.