6. Writing PC Software to Control the Jrk
There are two ways to write PC software to control the jrk: the native USB interface and the virtual serial port. The native USB interface provides more features than the serial port, such as the ability to change configuration parameters and select the jrk by its serial number. Also, the USB interface allows you to recover more easily from temporary disconnections. The virtual serial port interface is easier to use if you are not familiar with programming, and it can work with existing software programs that use serial ports, such as LabView.
Native USB Interface
The Pololu USB Software Development Kit supports Windows and Linux, and includes C# source code for:
- JrkExample: an example graphical application that uses native USB to send commands and receive feedback from the jrk and automatically recover from disconnection.
- JrkCmd: a command-line utility for configuring and controlling the jrk. JrkCmd has a streaming mode that allows you to steadily stream all of the jrk variables to the computer and output them in comma-separated format in case you want to make your own graphs or do something special with the data.
- C# .NET class libraries that enable native USB communication with the jrk.
You can modify the applications in the SDK to suit your needs or you can use the class libraries to integrate the jrk in to your own applications. Advanced users can also use the source code as a reference when writing custom applications in any language that control the jrk over USB.
Virtual Serial Ports
Almost any programming language is capable of accessing the COM ports created by the jrk. We recommend the Microsoft .NET framework, which is free to use and contains a SerialPort class that makes it easy to read and write bytes from a serial port. You can download Visual Studio Express (for either C#, C++, or Visual Basic) and write programs that use the SerialPort class to communicate with the jrk. You will need to set the jrk’s serial mode to be either “USB Dual Port” or “USB Chained”.