Support » Pololu Simple Motor Controller G2 User’s Guide »
7. Writing PC software to control the Simple Motor Controller G2
There are two ways to write PC software to control a Simple Motor Controller G2 that is connected via USB: you can use the native USB interface and the USB virtual serial port. The native USB interface provides more features than the serial port, such as the ability to change settings and select the Simple Motor Controller G2 by its serial number. Also, the USB interface allows you to recover more easily from temporary disconnections. The virtual serial port interface is often easier to use to get started with because of its simplicity and because of the availability of serial port libraries in many programming languages.
Native USB Interface
The simplest way to use the native USB interface is to write a program in the language of your choice that invokes smcg2cmd, the command-line utility that comes with the Simple Motor Controller G2 software. See Section 8 for example code that runs smcg2cmd.
For some examples that access the native USB interface more directly, see Section 8.3.
USB virtual serial port
Almost any programming language is capable of accessing the Simple Motor Controller G2’s USB virtual serial port. One option is 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. Also, see Section 8 for example code that works with the USB virtual serial port.