1+ /*
2+ * Author: Sebastien Parent-Charette (support@robotshop.com)
3+ * Version: 1.0.0
4+ * Licence: LGPL-3.0 (GNU Lesser General Public License version 3)
5+ *
6+ * Desscription: Example of all the possible configurations for a LSS.
7+ */
8+
9+ #include < LSS.h>
10+
11+ // ID set to default LSS ID = 0
12+ #define LSS_ID (0 )
13+ #define LSS_BAUD (LSS_DefaultBaud)
14+
15+ // Create one LSS object
16+ LSS myLSS = LSS(LSS_ID);
17+
18+ void setup ()
19+ {
20+ // Initialize the LSS bus
21+ LSS::initBus (Serial, LSS_BAUD);
22+
23+ // Uncomment any configurations that you wish to activate
24+ // You can see above each configuration a link to its description in the Lynxmotion wiki
25+ // Note: If you change a configuration to the same value that is already set,
26+ // the LSS will ignore the operation since the value is not changed.
27+
28+ // *** Basic configurations ***
29+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H6.OriginOffsetAction28O29
30+ // myLSS.setOriginOffset(0);
31+
32+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H7.AngularRange28AR29
33+ // myLSS.setAngularRange(uint16_t value, LSS_SetType setType = LSS_SetConfig);
34+
35+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H12.MaxSpeedinDegrees28SD29
36+ // Set maximum speed in (1/10°)/s
37+ // myLSS.setMaxSpeed(600, LSS_SetConfig);
38+
39+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H13.MaxSpeedinRPM28SR29
40+ // myLSS.setMaxSpeedRPM(100, LSS_SetConfig);
41+
42+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H14.LEDColor28LED29
43+ // Options are:
44+ // LSS_LED_Black = 0
45+ // LSS_LED_Red = 1
46+ // LSS_LED_Green = 2
47+ // LSS_LED_Blue = 3
48+ // LSS_LED_Yellow = 4
49+ // LSS_LED_Cyan = 5
50+ // LSS_LED_Magenta = 6
51+ // LSS_LED_White = 7
52+ // myLSS.setColorLED(LSS_LED_Black, LSS_SetConfig);
53+
54+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H15.GyreRotationDirection28G29
55+ // Options are:
56+ // LSS_GyreClockwise = 1
57+ // LSS_GyreCounterClockwise = -1
58+ // myLSS.setGyre(LSS_ConfigGyre value, LSS_SetConfig);
59+
60+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#H19.FirstA0Position28Degrees29
61+ // myLSS.setFirstPosition(0);
62+ // myLSS.clearFirstPosition();
63+
64+ // *** Advaned configurations ***
65+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA1.AngularStiffness28AS29
66+ // myLSS.setAngularStiffness(0, LSS_SetConfig);
67+
68+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA2.AngularHoldingStiffness28AH29
69+ // myLSS.setAngularHoldingStiffness(4, LSS_SetConfig);
70+
71+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA3:AngularAcceleration28AA29
72+ // myLSS.setAngularAcceleration(100, LSS_SetConfig);
73+
74+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA4:AngularDeceleration28AD29
75+ // myLSS.setAngularDeceleration(100, LSS_SetConfig);
76+
77+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA5:MotionControl28EM29
78+ // myLSS.setMotionControlEnabled(bool value);
79+
80+ // > https://www.robotshop.com/info/wiki/lynxmotion/view/lynxmotion-smart-servo/lss-communication-protocol/#HA6.ConfigureLEDBlinking28CLB29
81+ // Options are an arithmetic addition of the following values:
82+ // Limp 1
83+ // Holding 2
84+ // Accelerating 4
85+ // Decelerating 8
86+ // Free 16
87+ // Travelling 32
88+ // Therefore, 0 = no blinking and 63 = always blinking
89+ // myLSS.setBlinkingLED(0);
90+
91+ // Reset motor to complete change of configurations
92+ myLSS.reset ();
93+
94+ // Wait for reboot
95+ delay (2000 );
96+ }
97+
98+ void loop ()
99+ {
100+ // Loop through each of the 8 LED color (black = 0, red = 1, ..., white = 7)
101+ for (uint8_t i = LSS_LED_Black; i <= LSS_LED_White; i++)
102+ {
103+ // Set the color (session) of the LSS
104+ myLSS.setColorLED ((LSS_LED_Color)i);
105+ delay (1000 );
106+ }
107+ }
0 commit comments