Manual
int feedback = jrkGetFeedback(fd);
printf("Current Feedback is %d.\n", feedback);
int target = jrkGetTarget(fd);
printf("Current Target is %d.\n", target);
int newTarget = (target < 2048) ? 3000 : 1000;
printf("Setting Target to %d.\n", newTarget);
jrkSetTarget(fd, newTarget);
close(fd);
return 0;
}
4.i.2. Windows C
For example C code that shows how to control the jrk using its serial interface in Microsoft Windows, download
JrkSerialCWindows.zip [http://www.pololu.com/file/download/JrkSerialCWindows.zip?file_id=0J556] (4k zip). This zip
archive contains a Microsoft Visual C++ 2010 Express project that shows how to send a Set Target command and
also a Get Position command. It can also be compiled with MinGW. The jrk’s input mode needs to be set to “Serial”
and the serial mode needs to be set to “USB Dual Port” for this code to work. This example is like the previous
example except it does the serial communication using Windows-specific functions like CreateFile and WriteFile. See
the comments in the source code for more details.
Pololu Jrk USB Motor Controller User's Guide © 2001–2013 Pololu Corporation
4. Using the Serial Interface Page 39 of 44