Simplest method using the RoboClaw USB interface

Hi

So earlier I had some very naive questions about the JRK. Eventually that all worked but now I need help with the RoboClaw. I see the SimpleSerial example and it looks perfect for my purpose but I understand it is meant for an arduino. Is there a way to adapt this code for the USB control?

//Roboclaw simple serial example.  Set mode to 6.  Option to 4(38400 bps)
#include <SoftwareSerial.h>

//See limitations of Arduino SoftwareSerial

SoftwareSerial mySerial(10,11);

void setup() {
 mySerial.begin(38400);
}

void loop() {
  mySerial.write(1);
  mySerial.write(-127);
  delay(2000);
  mySerial.write(64);
  delay(1000);
  mySerial.write(127);
  mySerial.write(-1);
  delay(2000);
  mySerial.write(-64);
  delay(1000);
  mySerial.write(1);
  mySerial.write(-1);
  delay(2000);
  mySerial.write(0);
  delay(1000);
  mySerial.write(127);
  mySerial.write(-127);
  delay(2000);
  mySerial.write(0);
  delay(1000);
}

This code should do everything I need but I simply need to run these commands while connected to the USB port. If this isn’t possible then I am simply wondering how to run a motor when the RoboClaw is connected via USB. I do not think there is an SDK for this product so there is no file I can run with parameters like the JRK.

As always any help would be greatly appreciated, thank you for your time.

Hello.

It sounds like you are looking for the RoboClaw’s C# class library source code, which is linked on the downloads page on the Ion Motion Control website. If you start looking through the library and have questions, I recommend posting them on Ion Motion’s support forum.

- Amanda

I tried to post there but it did not go through. I know it’s a very dumb question but the C# lib doesn’t have any comments and I’m not familiar with the language. I just need the simplest way to run a motor with the RoboClaw. The files like USB.cs don’t have main methods so I have to create one for it to compile but I’m not sure if that’s right. Would I have to write a main method that runs the motor? There’s also no ReadMe in the lib so I’m not sure where else I can find this info. Sorry for my ignorance.

It looks like you were able to post on Ion Motion Control’s forum here and someone there has responded to you.

By the way, I did a quick search on Ion Motion Control’s forum and found this thread, where a very similar question was asked. You might find the attached sample program there helpful in getting you started with using the RoboClaw C# library.

- Amanda