Need help with Nubotics WheelCommander

I have a Nubotics WheelCommander and two Nubotics WheelWatcher encoders mounted on a BoeBot chassis and am attempting to control it with am Arduino Mega. Does anyone have any code samples for this. I just need something to get started. I have read the Nubotics manual and can't see what I am missing. I know that the wiring and power is ok because I can run the wheel servos with the Nubotics WheelCommander Wizard.

Any help on this would be greatly appreciated. Thanks

I am building a bot using a BoeBot chassis, Arduino Mega, and NuBotics wheel encoders and WheelCommander controller. My plan is to control the motion of the bot with minimal arduino coding using the WheelCommander so that I can focus the mega on other functions. The WheelCommander works great when controlling it with the NuBotics WheelCommander wizard so I know that the wiring and power is correct. My problem is controlling it from a sketch. Does anyone have any code for this that can get me started. I have read the manual and believe that I am sending the correct command, but must be missing something.

Thanks for you help in advance!

Please don’t post virtually identical questions in different parts of the forum.
It just wastes time.
(I don’t imagine “Network and protocols” was the best place for this anyway)

Sorry for the confusion on my part. First time forum user.

I have the grounds connected and get replys from the WheelCommander confirming that it received my commands. I sent the sketch below: Any ideas?

/*
_111021_ArdBotWC_Test Arduino Mega 2560
*/
#include <WheelCommander.h>
WheelCommander wc;

char incomingByte = 0;
void setup() {
Serial.begin(9600); // Ardino serial port setup
Serial1.begin(38400); // Wheel Commander serial port setup
pinMode(13, OUTPUT);
wc.SetWheelControl(WheelCommander::WC_BOTH);
wc.Sync();
wc.Reset();
}

void loop()
{
Serial.println(" Start ");

wc.SetAcceleration(0x200);
wc.SetAngle(0);
wc.SetVelocity(0x52);
wc.SetRotation(0x1000);
wc.SetDistance(0x3000);
wc.Go();

Serial.println(" Done ");

while(1){}
}
void Blink()
{
digitalWrite(13, HIGH); // set the LED on
delay(100); // wait for a second
digitalWrite(13, LOW); // set the LED off
delay(100); // wait for a second
}

I sent the sketch below

Sent it where? To Hawaii for a vacation? To school for an education?

I have the grounds connected and get replys from the WheelCommander confirming that it received my commands.

Doesn't sound like a problem to me.

      while(1){}

Once the WheelCommander is initialized, go into an infinite loop, doing nothing. Is this helping?

Any ideas?

About what? You haven't described a problem that you need help with.

Thanks for the reply PaulS. I'll try to explain. I am trying to control the wheel servos on a BoeBoe chassis by sending commands from an Arduino Mega to a Nubotics WheelCommander that is connected to the wheel Servos. I have mounted Nubotics Wheel Watcher 01 encoders on the wheels.

I have been successful at controlling the wheel servos if I use the Nubotics WheelCommander Wizard to send commands to the Nubotics WheelCommander. This leads me to believe that I have the wiring and power correct for the WheelCommander. I am using a Sparkfun FT232R breakout board to communicate with the WheelCommander when using the Wizard.

My problem is that I can't get the WheelCommander to control the wheel servos when I connect the Arduino to the WheelCommander using the above sketch. (I remove the Tx and Rx wires from the FT232R board and connect them to the Arduino Mega TX1 and RX1). The wheels do not turn at all. I believe that the communications between the Arduino and the WheelCommander is working as I get parameter information on the Arduino serial monitor when running the sketch. It lists the acceleration, velocity, etc numbers that I send to the WheelCommander from the Arduino. It just seems like I am missing something in the sketch. I have tried numerous combinations of wheelCommander instruction with no success.

The objective of the sketch is to make the wheel servos move forward a short distance. Once I get that to work, I will move on to more involved sketches.

Looking at the arduino example page on the Nubotics site, it appears that the library assumes that the wheelcommander hardware is attached to Serial, not Serial1 as you have it.

Thanks for your reply wildbill. I changed Serial1 to Serial in the sketch but it made no difference. ans

How about changing the wiring to match?

After I downloaded the sketch to the arduino, I disconnected the Arduino from the computer and moved the Tx and Rx wires from the WheelCommander over to TX0 and RX0 on the Arduino Mega, then reset the Arduino to run the sketch. ans

Hopefully you mean that you connected Wheelcomander Tx to Arduino Rx and vice versa?

Thanks wildbill! It turns out that after moving the wires to RX0 and TX0, it works fine!!!