i got 8 channel sain smart usb relay here: http://www.amazon.com/sainsmart-eight-channel-relay-automation/dp/b0093y89de/ref=sr_1_sc_1?ie=utf8&qid=1443224362&sr=8-1-spell&keywords=8+channel+relay+sain+smart
i trying connect device on windows 64 bit computer java. have downloaded of source code javaftd2xx project supposed utilize ftd2xx driver located on github.
the ftd2xx driver downloaded located here http://www.ftdichip.com/drivers/d2xx.htm
i downloaded 64 bit windows version , ran executable.
i opened javaftd2xx project in netbeans , created main class. here code main class.
list<ftdevice> ftdevices; //ftdevices= ftdevice.getdevices(true); ftdevices = ftdevice.getdevices(); (ftdevice ftdevice : ftdevices) { system.out.println("ftdevice:" + ftdevice); system.out.println("ftdevice.devtype:" + ftdevice.getdevtype()); system.out.println("ftdevice.devid:" + ftdevice.getdevid()); system.out.println("ftdevice.devlocationid:" + ftdevice.getdevlocationid()); ftdevice.open(); ftdevice.setbaudrate(9600); ftdevice.setdatacharacteristics(wordlength.bits_8, stopbits.stop_bits_1, parity.parity_none); ftdevice.settimeouts(1000, 1000); ftdevice.setbitmode((byte)0xff, bitmodes.bitmode_sync_bitbang); // set true (energised) or false (not energised) each relay (1 4) boolean relaystates[] = { true, true, true, true }; int value = 0; (int i=0; < relaystates.length; i++) { if (relaystates[i]) value += (1 << i); } ftdevice.write(value); ftdevice.close(); }
the error getting operating system not supported. further code, issue input stream null code below.
if (platform.iswindows()) { in = loader.class.getresourceasstream( "/natives/i386/ftd2xx.dll"); }
i have checked, , platform.iswindows() return true. have checked see if file exists in folder (i copied , pasted folder project) , see file. however, loader.class.getresourseasstream sets in null. can please either me working or provide other solution in other language. don't mind doing in language, preferably java.
thanks!
Comments
Post a Comment