-
-
Notifications
You must be signed in to change notification settings - Fork 6
Expand file tree
/
Copy pathSimpleConnection.java
More file actions
50 lines (40 loc) · 1.09 KB
/
SimpleConnection.java
File metadata and controls
50 lines (40 loc) · 1.09 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
package com.neuronrobotics.test.nrdk;
import com.neuronrobotics.sdk.genericdevice.GenericDevice;
import com.neuronrobotics.sdk.serial.SerialConnection;
// Auto-generated Javadoc
/**
* The Class SimpleConnection.
*/
public class SimpleConnection {
/**
* The main method.
*
* @param args the arguments
*/
public static void main(String[] args) {
SerialConnection s = null;
com.neuronrobotics.sdk.common.Log.error("Connecting and disconnecting");
//Windows
//s=new SerialConnection("COM5");
//OSX
//s=new SerialConnection("/dev/tty.usbmodemfd13411");
//Linux
s=new SerialConnection("/dev/DyIO1");
GenericDevice dyio = new GenericDevice(s);
//Log.enableDebugPrint(true);
dyio.connect();
double avg=0;
long start = System.currentTimeMillis();
int i;
for(i=0;i<500;i++){
dyio.ping();
double ms=System.currentTimeMillis()-start;
avg +=ms;
start = System.currentTimeMillis();
}
com.neuronrobotics.sdk.common.Log.error("Average cycle time for ping: "+(avg/i)+" ms");
dyio.disconnect();
System.exit(0);
//while(true);
}
}