Skip to content

Commit 5385922

Browse files
committed
I/O: Add helpful text for I2C errors
1 parent 03ba978 commit 5385922

File tree

1 file changed

+6
-0
lines changed
  • java/libraries/io/src/processing/io

1 file changed

+6
-0
lines changed

java/libraries/io/src/processing/io/I2C.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,9 @@ public void endTransmission() {
120120
transmitting = false;
121121
out = null;
122122
if (ret < 0) {
123+
if (ret == -5) { // EIO
124+
System.err.println("The device did not respond. Check the cabling and whether you are using the correct address.");
125+
}
123126
throw new RuntimeException(NativeInterface.getError(ret));
124127
}
125128
}
@@ -170,6 +173,9 @@ public byte[] read(int len) {
170173
transmitting = false;
171174
out = null;
172175
if (ret < 0) {
176+
if (ret == -5) { // EIO
177+
System.err.println("The device did not respond. Check the cabling and whether you are using the correct address.");
178+
}
173179
throw new RuntimeException(NativeInterface.getError(ret));
174180
}
175181

0 commit comments

Comments
 (0)