From 341a9073bed401b26e8c4671317b8f29889ca398 Mon Sep 17 00:00:00 2001 From: gohai Date: Mon, 12 Oct 2015 17:10:15 +0200 Subject: [PATCH] I/O: Add helpful text for I2C errors --- java/libraries/io/src/processing/io/I2C.java | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/java/libraries/io/src/processing/io/I2C.java b/java/libraries/io/src/processing/io/I2C.java index 936ae4259..77ebb41a6 100644 --- a/java/libraries/io/src/processing/io/I2C.java +++ b/java/libraries/io/src/processing/io/I2C.java @@ -120,6 +120,9 @@ public class I2C { transmitting = false; out = null; if (ret < 0) { + if (ret == -5) { // EIO + System.err.println("The device did not respond. Check the cabling and whether you are using the correct address."); + } throw new RuntimeException(NativeInterface.getError(ret)); } } @@ -170,6 +173,9 @@ public class I2C { transmitting = false; out = null; if (ret < 0) { + if (ret == -5) { // EIO + System.err.println("The device did not respond. Check the cabling and whether you are using the correct address."); + } throw new RuntimeException(NativeInterface.getError(ret)); }