O'Reilly logo

Arduino Development Cookbook by Cornel Amariei

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

External interrupts

Interrupts are weird things in the Arduino world; however, they are immensely useful. So what are they? Interrupts signal to the microcontroller that something has happened and it needs to take some action. Basically they work like this: we can attach an interrupt to a digital pin. Whenever it detects a change, it will pause anything the microcontroller is doing, execute a function we tell it to execute, and then resume normal operation.

In this example, we will fade two LEDs using PWM and while that is happening, we will be able to select which LED is fading using the button connected to an interrupt.

Getting ready

Following are the ingredients needed for this recipe:

  • An Arduino board connected to a computer via USB
  • Jumper cables ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required