6.7.4. Windows C Example

For example C code that shows how to control a Simple Motor Controller using its serial interface in Microsoft Windows, download SmcSerialCWindows.zip (5k zip). This zip archive contains a Microsoft Visual C++ 2010 Express project, and the provided C code can also be compiled with MinGW. This example is like the previous example except it does the serial communication Windows-specific functions like CreateFile and WriteFile.

For this example to work, the Simple Motor Controller’s input mode must be Serial/USB, the serial mode must be Binary, and the CRC Mode must be set to Disabled. These are the default settings that the controller is shipped with. The controller should be connected to the computer via USB.