i try to communicate with Denkovi relay board (FTDI) with a mac. If i try to open the FTDevice i get the excepction:
com.ftdi.FTD2XXException: D2XX error, ftStatus:INVALID_HANDLE
I installed the newest FTDI drivers.
I found this post: Using Java to access SainSmart 4 Relay with Mac OS 10.8.5 doesn't work
They write that the problem is the 64 bit JVM. But this was 4 years ago. Is there a solution now?
With the Denkovi original Software (Java too) i can communicate with the board. But i have only the Jar so i couldn't see the code how they do it.
My code:
public static void main(String[] args) {
FTDevice usb16Relay;
List<FTDevice> fTDevices;
byte[] command = new byte[5];
try {
fTDevices = FTDevice.getDevices();
usb16Relay = fTDevices.get(0);
System.out.println(usb16Relay.getDevDescription());
System.out.println(usb16Relay.getDevID());
System.out.println(usb16Relay.getDevSerialNumber());
usb16Relay.open();
usb16Relay.setBaudRate(9600);
usb16Relay.setDataCharacteristics(WordLength.BITS_8, StopBits.STOP_BITS_1, Parity.PARITY_NONE);
command[0]='x';
command[1]=1;
command[2]=0;
command[3]='/';
command[4]='/';
usb16Relay.write(command);
usb16Relay.close();
} catch (FTD2XXException ex) {
ex.printStackTrace();
}
}