Reference+
Name
interrupts()
Class
GPIO
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.
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(); }
Syntax
.interrupts()
Return
void
This work is licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.