Help interfacing Arduino and JrK 21v3

Hi everyone,
I have a project and I want to control a Linear actuator, the LACT6P, according to values given by an accelerometer. So the accelerometer is connected to an arduino and the actuator is controlled by the JrK 21v3. The problem is how to interface the arduino and the motor controller.
I searched in many places over internet, found that a connection via serial is possible using the RX and TX inputs in boath board so here’s what I made:
I connected the RX of the 21v3 to the TX (pine 1) of the arduino
I connected both GND of the 21v3 and the arduino
I selected UART detect baude rate in the configuration utility
I loaded this code I found online to the arduino:

* Motor control setup for pololu jrk21v3 with Arduino UNO R3, verified using linear actualtor LACT2P
* Pololu jrk config utility in Serial mode using UART detect baud rate interface. 
* starting with the default configuration settings for LACT2P linear actuators provided on the pololu website
* pin 8 connected to jrk pin Rx
* jrk grnd connected to arduino ground

#include <SoftwareSerial.h>
SoftwareSerial mySerial(7,8); // RX, TX, plug your control line into pin 8 and connect it to the RX pin on the JRK21v3

int myTarget = 0; // target position, 0-4095 is the range of the JRK21V3 controller. 

//stuff used for input from pc
char buffer[5] ;
int pointer = 0;
byte inByte = 0;

// announcer for PC Serial output
void announcePos(int (position)) {
  Serial.print("positiion set to ");

//sets the new target for the JRK21V3 controller, this uses pololu high resulution protocal
void Move(int x) {
  word target = x;  //only pass this ints, i tried doing math in this and the remainder error screwed something up
  mySerial.write(0xAA); //tells the controller we're starting to send it commands
  mySerial.write(0xB);   //This is the pololu device # you're connected too that is found in the config utility(converted to hex). I'm using #11 in this example
  mySerial.write(0x40 + (target & 0x1F)); //first half of the target, see the pololu jrk manual for more specifics
  mySerial.write((target >> 5) & 0x7F);   //second half of the target, " " " 

void setup()
  Serial.flush();// Give reader a chance to see the output.

  int myTarget = 0; //the health level at any point in time
  Serial.println("Enter '#' and 4 digit position level (#0000-#4095)");



void loop()

  if (Serial.available() >0) {
   // read the incoming byte:
   inByte =;
   // If the marker's found, next 4 characters are the position
   if (inByte == '#') {

     while (pointer < 4) { // accumulate 4 chars
        buffer[pointer] =; // store in the buffer
        pointer++; // move the pointer forward by 1
      //translating into an int
      pointer =0;
   //makes sure the target is within the bounds
   if (myTarget < 0){
      myTarget = 0;
   else if (myTarget > 4095){


when I load it to the arduino, there is a vibration in the actuator so it seems the connection is ok, but when I open serial monitor and give values there is no reaction at all! Notice that the actuator works properly when I manually set target with the configuration utility.
Can you help me plz, I’m not familiar with this language to properly understand what’s wrong with that code or make my own!

Briefly looking at the code you posted, it looks like it uses software serial and specifies that pin 8 should be connected to the jrk’s RX pin (instead of pin 1, which is the hardware serial pin).

If that does not fix the problem, have you configured the jrk for use with that actuator? If not, I recommend going through the instructions listed under the “Using a jrk motor controller with a linear actuator with feedback” heading of the LACT6P-12V-20 Linear Actuator with Feedback product page. Once you get the actuator working without the Arduino, then you can set the Input mode to “Serial” and the Serial Interface to “UART, detect baud rate” before connecting your Arduino.