Am trying to port Massixon's support (python) for the Adifruit MMA8541 accerometer to java.
The MMA8541 is said to require "repeated start I2C support".
Pi4J throws exception upon attempting the I2CDevice.getDevice()
The output from the attached .java file is:
instanced bus ok
luxDevice=com.pi4j.io.i2c.impl.I2CDeviceImpl@ea2f77
device=com.pi4j.io.i2c.impl.I2CDeviceImpl@1c7353a
Exception in thread "main" java.io.IOException: Error reading from I2CDevice on I2CBus '1' ('/dev/i2c-1') at address 0x1d to address 0x2a. Got '-20001'.
at com.pi4j.io.i2c.impl.I2CDeviceImpl.read(I2CDeviceImpl.java:227)
at myJavaStuff.MMA8451.main(MMA8451.java:323)
1) My Raspberry Pi 3 Model B is able function with the MMA8541
2) The Adifruit documentation of the default address as 0x1C might need to be corrected.
I mention this only in that if anyone is trying to diagnose with hardware the address becomes important.
My board has no connection to the A address select pin, but the Massixon default address of i2caddr = 0x1D works
Have acquired a TSL2561, and successfully executed the Pi4J I2CExample.java, which uses the I2CDevice.getDevice($ADDR)