Search wiring.org.co:

Reference for Wiring version 1.0 Build 0100+ If you have a previous version, use the reference included with your software. If see any errors or have any comments, let us know.

Name |

### detachInterrupt()

Examples |
    int val = 0;

    void setup() {
      // set myFunction to be called everytime
      // interrupt 2 is generated
      attachInterrupt(EXTERNAL_INTERRUPT_2, myFunction, RISING);
      // Starts serial to print data
      Serial.begin(9600);
    }

    void loop() {
      val = val + 1;
      if (val > 10000) {
        detachInterrupt(EXTERNAL_INTERRUPT_2);
      }
      delay(100);
    }

    void myFunction() {
      // WARNING: you should avoid doing long procedures in interrupt routines
      // Since this is an interrupt routine
      // and Serial is an interrupt driven output
      // interrupts must be enabled before printing
      interrupts();
      Serial.print("Interruption generated");
    }
Description | It is possible to generate and attend external interrupts on the Wiring hardware. On Wiring v1 boards the external interrupts capable pins are: 0, 1, 2, 3, 36, 37, 38 and 39. On Wiring S board the external interrupts capable pins are: 2, 3 and 18. In addition to being regular digital pins, note that some of these pins are also used for libraries like Wire or Serial/Serial1. The attachInterrupt() method sets the function that executes whenever an external interrupt is generated, and the detachInterrupt() method clears the function used to attend a specific interrupt. WARNING: you should avoid doing long procedures in interrupt routines, also see the call to interrupts() in the example above enabling interrupts to allow the use of Serial in the interrupt routine.
Syntax |
    detachInterrupt(interrupt)
Parameters |

interrupt | The number of the external interrupt: EXTERNAL_INTERRUPT_0, EXTERNAL_INTERRUPT_1 .. etc.

Returns | None
Usage | Application
Related | attachInterrupt() interruptMode() LOW CHANGE FALLING
RISING

Updated on July 07, 2011 11:08:08pm PDT