Hello ,
Please I need help with Arduino code. I’m using the LSS_sweep code for lynx motion servo. I want the servo to rotates from 0 to 210 slowly and have 5 sec rest then from 210 to 0. When I use the code below my robot arm rotates fast and it is doing a full rotation.
#include <LSS.h>
// ID set to default LSS ID = 0
#define LSS_ID (0)
#define LSS_BAUD (LSS_DefaultBaud)
// Create one LSS object
LSS myLSS = LSS(LSS_ID);
void setup()
{
// Initialize the LSS bus
LSS::initBus(Serial, LSS_BAUD);
// Initialize LSS to position 0.0 °
myLSS.move(0);
// Wait for it to get there
delay(2000);
}
// Loops between - 210.0° and 210°, taking 1 second pause between each half-circle move.
void loop()
{
// Send LSS to half a turn counter-clockwise from zero (assumes gyre = 1)
myLSS.move(-2100);
// Wait for five second
delay(5000);
// Send LSS to half a turn clockwise from zero (assumes gyre = 1)
myLSS.move(2100);
// Wait for five second
delay(5000);
}
Hi @mtamdjo,
There are two main ways to limit the maximum speed of a motion with the LSS:
- Limit the maximum speed of the LSS using a session or configuration setting (before the move), such as SD/CSD and SR/CSR.
- Limit the maximum speed of the LSS using a modifier to your move command in speed or time, such as T and SD.
It just so happens there was an update to the LSS Arduino library just two days ago (version 1.3) that adds moveT and moveRelativeT commands. You can obtain the update through the Arduino IDE library manager by checking your update-able libraries and click the update button on them.
With these new functions you could control motion over time easily by doing something like:
myLSS.moveT(-2100, 4000); // Move to -210° over 4 seconds
myLSS.moveT(2100, 3000); // Move to 210° over 4 seconds
Sincerely,
Thank you. It helped a lot .
1 Like
Glad to be of service!
More updates will be coming in in the future, too. Feel free to let us know if you have any other ideas.
If you wish for a more direct approach, you can fork the repo on GitHub, add/modify the code and create pull requests with us! We’ll gladly look over at any improvements the community wishes to provide!
Sincerely,