
The baud rate specified in this code and in the Jrk’s settings do not have to match because the serial bytes are transferred via USB. If the Jrk is connected to your PC via USB, you will need to set the Jrk’s serial mode to “USB dual port” in the “Input” tab of the Jrk G2 Configuration Utility. Also, you will need to change the const char * device line in the code that specifies what serial port to connect to. The Jrk’s input mode should be set to “Serial / I2C / USB”, or else the “Set target” command will not work.

For a very similar example that works on Linux and macOS, see Section 15.5.

It demonstrates how to set the target of the Jrk by sending a “Set target” command and how to read variables using a “Get variables” command. The example C code below uses the Windows API to communicate with a Jrk G2 via serial.
