- Processing
- p5.js
- Processing.py
- Processing for Android

- Processing Foundation

This reference is for Processing 3.0+. If you have a previous version, use the reference included with your software in the Help menu. If you see any errors or have suggestions, please let us know. If you prefer a more technical reference, visit the Processing Core Javadoc and Libraries Javadoc.

Class | GPIO
Name | ### interrupts()
Examples |
    import processing.io.*;
    color bgcolor = 0;

    void setup() {
      GPIO.pinMode(4, GPIO.INPUT);
      GPIO.pinMode(5, GPIO.INPUT);
      GPIO.attachInterrupt(4, this, "pinEvent", GPIO.RISING);
      GPIO.attachInterrupt(5, this, "pinEvent", GPIO.RISING);
    }

    void draw() {
      background(bgcolor);
    }

    void pinEvent(int pin) {
      GPIO.noInterrupts();
      println("Received interrupt on pin" + pin);
      if (bgcolor == 0) {
        bgcolor = color(255);
      } else {
        bgcolor = color(0);
      }
      // re-enable interrupts
      GPIO.interrupts();
    }
Description | Allows interrupts to happen You can use noInterrupts() and interrupts() in tandem to make sure no interrupts are occuring while your sketch is doing a particular task. By default, interrupts are enabled.
Syntax |
    .interrupts()
Returns | void

Updated on November 10, 2017 05:36:31pm EST