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 | |
---|---|
Name | noInterrupts() |
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(); // no other interrupt will disturb us println("Received interrupt on pin" + pin); if (bgcolor == 0) { bgcolor = color(255); } else { bgcolor = color(0); } GPIO.interrupts(); } |
Description |
Prevents interrupts from happpening You can use noInterrupts() and interrupts() in tandem to make sure no interrupts are occuring while your sketch is doing a particular task. While a method associated with a pin's interrupt is being executed, interrupts from the same pin are automatically prevented from occurring. Interrupts from other pins can still happen, however. If you also want to prevent those, put noInterrupts() at the beginning of your callback function and interrupts() at its end. |
Syntax | .noInterrupts() |
Returns | void |
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.