...
The Lynxmotion Smart Servos (LSS) are compact, modular and configurable actuators that provide greater control than standard PWM servos. The servo lineup currently includes three “smart servos” which appear physically the same, sharing the same dimensions and mounting points but differing in maximum torque and speed.
...
The lynx motion has a simple serial protocol for controlling the motor, that is human-readable:
Number sign #
Servo ID number as an integer
Action command (two to three letters, no spaces, capital or lower case)
Configuration value in the correct units with no decimal
End with a control / carriage return '<cr>'
Ex: #5PD1443<cr>
Additional Parts:
...
For controlling multiple servos, you will first need to give each motor a unique ID. You must attach each motor separately and modify the code below to change its ID to a value between 0 and 253. Afterwards, the servo will always remember it’s new ID.
Code Block | ||
---|---|---|
| ||
#include <LSS.h> #include <SoftwareSerial.h> SoftwareSerial servoSerialmySerial(8, 9); // ID set to default LSS ID = 0 #define LSS_ID_old (254) // ID 254 to broadcast to every motor on bus #define LSS_ID (0) // the new ID #define LSS_BAUD (LSS_DefaultBaud) // Create one LSS object LSS myLSS = LSS(LSS_ID); void setup() { mySerial.begin(115200); // Important! this setis the datastandard ratespeed for thetalking SoftwareSerialto portLSS servoSerialmySerial.begin(LSS_BAUDprint("#0D1500\r"); // this is used to clear the serial buffer servoSerial.print("#0D1500\r"); delay(1000); LSS::initBus(servoSerial, LSS_BAUD); //change ID servoSerialmySerial.print(String("#") + LSS_ID_old + String("CID") + LSS_ID + "\r"); delay(2000); } void loop() { } |
...
Code Block | ||
---|---|---|
| ||
#include <LSS<SoftwareSerial.h> #include <SoftwareSerial.h> SoftwareSerial servoSerialmySerial(8, 9); #define LSS_ID1 (1) #define LSS_ID2 (0) #define LSS_BAUD int (LSS_DefaultBaud)direction // Create two LSS objects LSS myLSS1 = LSS(LSS_ID1); LSS myLSS2 = LSS(LSS_ID2); int direction = -= -1; void setup() { servoSerialmySerial.begin(LSS_BAUD115200); // InitializeImportant! thethis LSSis busthe standard LSS::initBus(servoSerial, LSS_BAUD);speed for talking to LSS SerialmySerial.begin(LSS_BAUD); print("#0D1500\r"); // this is used to clear the serial buffer } void loop() { { // motor direction mySerial.print(String("#") + LSS_ID + String("WR") +-direction*60) + "\r"); // motorRPM directionmove myLSS1.wheelRPM(-direction*60); myLSS2.wheelRPM(60*direction);mySerial.print(String("#") + LSS_ID + String("WR") + 60*direction + "\r"); // RPM move delay(40005000); // reversreverse dierctiondirection direction = -direction; } |
...