Inerfacing jrk 21v3 with Arduino Duemilanove

I have been trying to make a serial connection with the Pololu JRK21v3 motor controller with no success. I am sure that I have made the correct connections with the TX and RX lines and connected the grounds. I have also configured the JRK to be in the UART mode

My code that I have been using is the following. I would appreciate any help on this.

// This function prints “siz” HEX values from the “buf” array

byte rx= 2;
byte tx =3;
byte SWval;

void PrintHexBuffer(unsigned char *buf, size_t siz)

{

for (size_t i=0; i<siz; ++i)
Serial.println(buf*, HEX);*
}
void setup()
{

  • Serial.begin(9600); *
    pinMode(rx, INPUT); // Serial Recieve Pin
    pinMode(tx, OUTPUT); // Serial Transmit Pin

}
void loop()
{

unsigned char hex_buf[] = {0xAA, 0x0B, 0x61, 0x7F};
PrintHexBuffer(hex_buf, sizeof(hex_buf));

}

The hardware serial class uses pins 0 and 1, not 2 and 3. Which pins did you connect the controller to?

Thanks for the reply. It is possible to send serial Since the Arduino's serial lines are used for programming and debugging, I use the SoftwareSerial library to send data to the on pins other than the hardware serial lines (0 and 1). If I use the 0 and 1 pins while debugging, I get an error.

Reference Language (extended) | Libraries | Comparison | Changes

SoftwareSerial(rxPin, txPin) Description A call to SoftwareSerial(rxPin, txPin) creates a new SoftwareSerial object, whose name you need to provide as in the example below. You still need to call SoftwareSerial.begin().

Parameters rxPin: the pin on which to receive serial data

txPin: the pin on which to transmit serial data

Example

define rxPin 2

define txPin 3

// set up a new serial port SoftwareSerial mySerial = SoftwareSerial(rxPin, txPin);

See also ?SoftwareSerial.begin() ?SoftwareSerial.read() ?SoftwareSerial.print() ?SoftwareSerial.println()

Reference Home

Corrections, suggestions, and new documentation should be posted to the Forum.

The text of the Arduino reference is licensed under a Creative Commons Attribution-ShareAlike 3.0 License. Code samples in the reference are released into the public domain.

You didn’t answer my question.

The only serial data that you are sending is being sent using the Serial.println() function, which is sending data to the hardware serial port (pins 0 and 1).

If the motor controller is connected to those pins, perhaps it is the extra CR\LF that println adds that is causing the problem.

If the motor controller is connected to pins 2 and 3, perhaps you need to create an instance of the SoftwareSerial class that is actually associated with those pins, and use the SoftwareSerial instance (actually, NewSoftSerial is preferred) to send data to those pins.