Communicating with Motor Controller

I am having trouble communicating with two 24v12 Simple Motor Controllers in C#.

I am trying to write a program in C# that will allow me to simply set the serial number and speed of the specific device at any time.

Basically this is what I would like to happen inside the program (no command line or external instructions).
1)Use a string to set the appropriate device(probably by serial no.)
2)Constantly be able to update the speed of that device at any moment
3)Do this for multiple motor controllers at the same time

For example:

//where SMC1 and SMC2 are objects (that I don't know how to set up yet??)

SMC1.serial = "1234...";
SMC2.serial ="5678...";

int A = 6;
int B = 3;

if(A > 5)
   SMC1.speed(2000);

if (B<4)
    SMC2.speed(1000)

//and then when desired later, I would like to update the speeds again (actually I'll be doing this constantly throughout the code)

I tried going through the provided examples: (Smc and SmcCmd and SmcExample1).
I know for sure that VS 2013 is set up correctly and that all the necessary references and classes (setting.cs, protocol.cs etc.) are there but I
just can’t get it to work with getting errors.

SmcSerialCWindows.c (pololu.com/docs/0J44/6.7.4) basically demonstrates exactly what I’m trying to do in C#:

What do I do to be able to simple set the serial number and then control the Motor Controllers via code only?

Hello.

The SmcSerialCWindows.c file you mention uses the Simple Motor Controller’s virtual serial ports. If you want to do the same thing in C#, you should look into using the System.IO.Ports.SerialPort class. However, it will be very hard to locate the Simple Motor Controllers based on their serial number. The way you would probably locate them is by their COM port number (e.g. “COM7”). The COM port numbers are assigned by Windows based on the serial number of the device, so they are a good way to select what device you want to control.

If you want to use the Simple Motor Controller’s native USB interface instead of the serial ports, then you should use SmcExample1 in the Pololu USB SDK as your starting point. That example has comments in it explaining how you could select a controller based on its serial number. I would need more information about what you tried and what exact errors you are getting in order to help you compile that example.

–David