File tree Expand file tree Collapse file tree 1 file changed +6
-3
lines changed
java/libraries/io/src/processing/io Expand file tree Collapse file tree 1 file changed +6
-3
lines changed Original file line number Diff line number Diff line change @@ -456,15 +456,18 @@ public static void waitFor(int pin, int mode) {
456456
457457 /**
458458 * Waits for the value of an input pin to change
459+ *
460+ * This function will throw a RuntimeException in case of a timeout.
459461 * @param pin GPIO pin
460462 * @param mode what to wait for: GPIO.CHANGE, GPIO.FALLING or GPIO.RISING
461463 * @param timeout don't wait more than timeout milliseconds
462- * @return true if the interrupt occured, false if the timeout occured
463464 * @webref
464465 */
465- public static boolean waitFor (int pin , int mode , int timeout ) {
466+ public static void waitFor (int pin , int mode , int timeout ) {
466467 enableInterrupt (pin , mode );
467- return waitForInterrupt (pin , timeout );
468+ if (waitForInterrupt (pin , timeout ) == false ) {
469+ throw new RuntimeException ("Timeout occurred" );
470+ }
468471 }
469472
470473
You can’t perform that action at this time.
0 commit comments