Arduino Interrupts Tutorial

preview_player
Показать описание
Dear friends welcome to this Arduino Interrupt Tutorial. In this video we are going to learn how to use interrupts with Arduino, an advanced but extremely useful feature of the Arduino. There is a lot to cover, so without any further delay let's get started!

But what is an interrupt? Most microprocessors have interrupts. Interrupts let you respond to external events while doing something else. Suppose you are sitting at home waiting for the new ESP32 board, you have ordered a few days ago, to arrive at your mailbox. You are very excited so you check your mailbox every ten minutes to see if the board has arrived. This procedure is called polling, and we were using this technique a lot in our projects. But what if we had told the mailman to ring the doorbell at his arrival? This way, we are free to do anything we want and at the time the board arrives at the mailbox we get notified and we can use it at once. This example explains exactly how an interrupt causes a processor to act.

Want to learn to code?

Рекомендации по теме
Комментарии
Автор

I hope you took away lots from this video and you managed to understand how interrupts work. Let me know below!

PS. WANT TO LEARN CODING? CHECK MY NEW YOUTUBE CHANNEL!

Educs
Автор

....so you check your mailbox every ten minutes. Best example of how interrupts work that I have heard. Thank you.

cw
Автор

"without any further delay let's get started!"
I see what you did there... I see it!

kudos to you Mr. educ8s!

theambient
Автор

To show the true power of interrupts write a loop to blink an LED once per second. Then use the same code using the sensor to turn a second LED on or off by interrupt as you have done here. The demonstration will show how you can do two things at once using interrupts! Please show this on a future video.

Thanks for all your good work! I thoroughly enjoy your videos! Your pace and explanations are outstanding!

joedempseysr.
Автор

Thank you for the great video. For the second PIR motion detect example, it can be simplified by using only one interrupt (digital pin 2) to control the led on/off. The following modified code works very well:

#include "LowPower.h"
#define PIRmotion 2
#define LedPin 13
void setup() {
pinMode(LedPin, OUTPUT);
pinMode(PIRmotion, INPUT);
attachInterrupt(digitalPinToInterrupt(PIRmotion), OutputLED, CHANGE);
}

void loop() {
, ADC_OFF, BOD_OFF);
}

void OutputLED(){
digitalWrite(LedPin, digitalRead(PIRmotion));
}

noteredmi
Автор

I've always had a hard time understanding how to use and program interrupts. Best description of interrupts I have seen yet. Simple and elegant. Thanks.

DaveBuildsThings
Автор

Best explanation of interrupts I've heard. It's a well-done video with easy-to-follow instructions. I must admit I had to back up and turn on subtitles on in certain sections. I've worked with Arduinos for a while now and never heard the term "distal pin" before. After turning on subtitles I realized it was "digital pin" and suddenly everything made sense. 😄How is this the first time I've heard this guy? Now I have to check the rest of his videos. Good bye productive afternoon! lol

karlsangree
Автор

Thanks for this explanation. I successfully built an NES controller using an ESP32 that will mimic an 8-Bit shift register. It works on an actual Orgina Nintendo console.😀

Mailmartinviljoen
Автор

Just a little notice at the end part that you could have only used one interrupt on CHANGE mode and if the state of the interrupt pin is high, turn it on. If low, turn it off. It's a good idea to try and save the use of interrupt pins as much as possible, especially on an Uno.

caffeinatedinsanity
Автор

I am taking your tuition seriously. I am creating a control algorithm for an Arduino Nano that has two hardware interrupts(input from Photo_interrupter, and input from Photo Beam detector parallel with a Push_Button switch) 2 Software Interrupts(Counter resets). Thank you for the clear explanations.

nolantaylor
Автор

This is a fantastic video. Very clear and easy to follow. The pace of your teaching was perfect and the graphic illustrations some of the best to make this understandable. I will apply this technique to a water alarm I have planned. I want the moisture sensor to wake up the arduino and send an alarm via wifi or sms. Thank you!

tbyers
Автор

Simple, clear explanation of how to use interrupts with an Arduino. Perfect for dummies like me.

kevinbyrne
Автор

Thank you. I’m working on my first project that is battery powered and was looking for a good way to save power. This is exactly what the doctor ordered.

jimstarr
Автор

By far the best tutorial on interrupts I have seen & I have watched & read very many. Thank you so much for sharing this which is an extraordinary useful assistance to me.

springwoodcottage
Автор

I have used timer interrupts but not hardware interrupts. The hardware interrupts are much easier and more useful. With this video there is no reason not to use them. Thank you.

triac
Автор

Your teaching is unique and clear see how you impact the knowledge I ve been seeking since I come across mcu's interrupt well explaned

paulpixzy
Автор

Very useful information! I was not aware that hardware interrupts could wake the Arduino from a deep sleep and then go back to sleep right after.

MJLMICRO
Автор

φιλε πολυ καλος αυτο ηταν απο τα πιο ενδιαφεροντα που εχεις κανει με την μεθοδο των διακοπών γιατι ειναι πολυ χρησιμο πολύ καλή δουλειά συνέχισε :D

kasskon
Автор

Well explained. I've not really understood the basics of interrupts till now.

dubbadan
Автор

I recently learned to use interrupts when learning to program ATmel controllers without the help of an Arduino. It's good to see now how to use them with the Arduino.

ValseInstrumentalist