Created
June 2, 2014 15:45
-
-
Save harshadura/0ec66ff67064d653060b to your computer and use it in GitHub Desktop.
obd2
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package lancerscan; | |
import jd2xx.JD2XX; | |
public class Test { | |
public static void main(String[] args) throws Exception { | |
JD2XX jd = new JD2XX(); | |
jd.open(0); | |
int bytesAvailable = 0; | |
while (bytesAvailable < 4) { | |
jd.setBreakOn(); | |
try { | |
Thread.sleep(1800); | |
} catch (InterruptedException ex) { | |
Thread.currentThread().interrupt(); | |
} | |
jd.setBreakOff(); | |
bytesAvailable = jd.getQueueStatus(); | |
System.out.println(bytesAvailable); | |
} | |
if (bytesAvailable == 4) { | |
System.out.println("INIT complete"); | |
jd.setBaudRate(15625); | |
String msg = "33"; | |
int ret = jd.write(msg.getBytes()); | |
System.out.println(ret + " bytes sent."); | |
Thread.sleep(1800); | |
int response = jd.getQueueStatus(); | |
System.out.println("Engine RPM : >>> " + response); | |
} | |
} | |
} |
Please provide a link to download jd2xx jar for ubuntu.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
i get a reply saying:
1 2 3 4 INIT complete 2 bytes sent. Engine RPM : >>> 6