LSS Library and hardware serial addressing of LSS Motors

I have three LSS-HT1 motors attached to a robot connected to an LSS Adapter board.

I am using an Arduino Mega to communicate and I have connected pins 14 and 15 of the Mega to pins 0 and 1 of the Adapter board. (They are side by side and not used as a shield)

I am using the LSS library for Arduino and since all examples are using only one motor, I want to double-check if what I am doing is correct.

The basic infrastructure for the LSS is as follows (the entire sketch is wayyy to long - I am just pasting the LSS portions)

#include <LSS.h>
#define LSSTx 14 //LSS Serial3
#define LSSRx 15 //LSS Serial3
#define LSS_ID (0)
#define LSS_BAUD (19200)
LSS M4 = LSS(1);
LSS M5 = LSS(2);
LSS M6 = LSS(3);

In setup()

LSS::initBus(Serial3, LSS_BAUD);
M4.move(0);
M5.move(0);
M6.move(0);

`indent preformatted text by 4 spaces`

Now – in the loop, I can easily write

M3.move(1800);

to move a specific motor

However, M6 is a gripper and as previously instructed, I want to use the move and hold if current reaches X command.

So … how do I do it with the LSS Library?

Or, can I just use:

Serial3.println ("#3D450CH300");

while bypassing the library and writing directly?

( I apologize if this has been addressed elsewhere - I looked but couldn’t find anything)

1 Like

@cosmicone You seem to understand wiring and programming, so why not, as you mentioned, write the commands yourself and bypass the library? As you said, moving servo with ID 3 to 45.0 degrees, with a current hold modifier of 300mA would be:

Serial.println("#3D450CH300");

If you use a different serial pin on the mega, adjust the code (as you did) accordingly.

1 Like

The current hold command is implemented in the Arduino library as shown in line 272 of LSS.h
Therefore, to move your M6 LSS gripper to, let’s say an angle of 450 degrees and hold if current reaches 300mA, the LSS serial command would be “#6D450CH300” and would translates as follows in Arduino code:

M6.moveCH(450, 300);

Btw, the LSS default baudrate is 115200. In your code you seem to have a baudrate of 19200. Did you change the LSS baudrate to match the Arduino code’s baudrate ?

1 Like

Thank you. That is what I was looking for – using the library makes it easier to program.

Yes … I changed the baud rate of all the motors because they are about 1.1 meters away from the adapter board and someone here suggested to lower the baud rate for that distance.

2 Likes