I have been able to get these two items to work on my Raspberry Pi. I am making a device to sense the rotational angle of the crank on a punch press and report the angle to the operator. I have adapted the java script that I downloaded from your website and on a very basic level made it collect the position and display it. I need these items to make it work.
The issue I’m facing is as I attempt to create Methods that I’ll reuse that I do not know how to instantiate the I2C objects. Using this in main works perfectly:
// Create I2C bus
I2CBus Bus = I2CFactory.getInstance(I2CBus.BUS_1);
// Get I2C device, A1332 I2C address is 0x0C(12)
I2CDevice Idevice = Bus.getDevice(0x0C);
// Get I2C device, AS1115 I2C address is 0x00(00)
I2CDevice Odevice = Bus.getDevice(0x00);
If i create:
public void getAngle() {
// Get the angle from A1332
}
public void showAngle() {
// Display the angle on the AS1115
}
inside the class I don’t know where to place this. I have tried several times and it fails to work. I do not see many examples in Java and when I search for Java I don’t see anything dealing with I2C.