0PricingLogin
Arduino & IoT Academy · Lesson

attachInterrupt on a Pin

Run code the instant a signal changes.

Wiring Code to a Pin

The attachInterrupt function tells your board: watch this pin, and the moment its signal changes, run my function right away.

Only Special Pins

Not every pin supports interrupts. On an Uno only pins 2 and 3 do, so plug your signal into one of those.

All lessons in this course

  1. Polling vs Interrupts
  2. attachInterrupt on a Pin
  3. Writing a Safe ISR
  4. Count Pulses from an Encoder
← Back to Arduino & IoT Academy