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 | waitForInterrupt() |
||||||
Examples | import processing.io.*; void setup() { GPIO.pinMode(4, GPIO.OUTPUT); GPIO.pinMode(5, GPIO.INPUT); // trigger a reset of an external device with GPIO 4 GPIO.digitalWrite(4, GPIO.HIGH); // wait for the device signalling us that it's ready // by pulling up our pin 5 boolean success = GPIO.waitForInterrupt(5, GPIO.RISING, 1000); if (!success) { println("Device didn't wake up in time"); exit(); } // do something else... } | ||||||
Description |
Waits for the value of an input pin to change The mode parameter determines when the function will return: GPIO.FALLING occurs when the level changes from high to low, GPIO.RISING when the level changes from low to high, and GPIO.CHANGE when either occurs. This function returns true if the change, false if the timeout occured. |
||||||
Syntax | .waitForInterrupt(pin, mode, timeout) | ||||||
Parameters |
| ||||||
Returns | boolean |