just doing some off-season tinkering.
Students got comms going from Java to a RIODuino over I2C just fine; the Arduino Wire library’s receive_slave example hooks up perfectly to the WPIlib I2C class write methods.
We’re stumped on receiving data from the RIODuino. We added a onRequest handler to the Arduino receive_slave example.
If we do a
boolean b = rioDunio.read(44, yy.length, yy);
the Arduino gets a 1 byte onReceive event with the 44 register number. The Arduino’s onRequest event never fires off.
If we do a
boolean b = rioDunio.readOnly(yy, yy.length);
and yy is a 6 byte array, and we have the Arduino’s onRequest handler do a
Wire.write("hello ");
we can see the Arduino’s onRequest handler firing off, but the readOnly call always returns a true value (indicating an aborted transfer), and the returned buffer is always full of zeroes.
Has anyone successfully read data from an Arduino using I2C?
We’re prepared to do serial (and know how), but we are really trying to figure out the pros and cons of both, and want to make sure that we have an accurate idea of limitations of I2C between a RoboRIO and Arduino…