ExternalInterrupts \ Learning \ Wiring ALPHA 1.0
Author: Hernando Barragán
Description: Wiring is an electronic sketchbook and hardware electronics for developing ideas. It is a context for learning fundamentals of computer programming and prototyping with electronics within the context of the electronic arts.
Keywords: Wiring, Processing, Interactive Media, Electronic Arts, Programming, C, C++, Hernando Barragán

Search wiring.org.co:

This example is for Wiring version 0023+. If you have a previous version, use the examples included with your software. If you see any errors or have comments, please let us know.

External interrupts by BARRAGAN
Demonstrates how to attend an externa interrupt generated on the digital pin 0. It is possible to generate and attend external interrupts on the Wiring I/O board. There are 8 external interrupts, from 0 to 7 so there are 8 pins on the Wiring I/O board capable of external interrupts, 0, 1, 2, 3, 36, 37, 38, and 39 respectively.

    void setup() {
      // set myFunction to be called everytime
      // interrupt 0 is generated (everytime the pin gets HIGH)
      attachInterrupt(0, myFunction, HIGH);
      Serial.begin(9600);  // Starts serial to print data
    }

    void loop() {

    }

    void myFunction() {
      Serial.print("Interrupt generated");
    }