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.

Related Products

High-Power Simple Motor Controller G2 18v15 (Connectors Soldered)
High-Power Simple Motor Controller G2 18v15
High-Power Simple Motor Controller G2 24v12 (Connectors Soldered)
High-Power Simple Motor Controller G2 24v12
High-Power Simple Motor Controller G2 18v25
High-Power Simple Motor Controller G2 24v19
Log In
Pololu Robotics & Electronics
Shopping cart
(702) 262-6648
Same-day shipping, worldwide
Menu
Shop Blog Forum Support
My account Comments or questions? About Pololu Contact Ordering information Distributors