Course Curriculum

Hardware interrupts Part 2: Using volatile variables

This lecture will show you how to use the hardware interrupt. In the this lecture, I will also show you how to use a relevant feature called the Time Interrupt. A hardware interrupt provides the ability to tie a special pin with a function in your sketch that will be executed with priority when the state of the pin changes in a particular way.

In the second demo, we'll add a volatile variable which the code in the interrupt request function will be able to access and update.

This variable will keep track of the number of times that we have pressed on the button.

All sketches in this lecture can be downloaded from Github (the link is in External Resources).

View external resources


Did you find a problem with the school web site? Please use this form to report it (the form contains specific questions to help us fix the problem quickly).