### Install SCServo Library via Arduino CLI Source: https://context7.com/workloads/scservo/llms.txt Instructions for installing the SCServo library using the Arduino CLI. Supports installing the latest version or a specific version. ```bash # Install the latest version arduino-cli lib install SCServo # Install a specific version arduino-cli lib install SCServo@1.0.2 ``` -------------------------------- ### Install SCServo Library via Git Source: https://context7.com/workloads/scservo/llms.txt Instructions for installing the development version of the SCServo library directly from its GitHub repository using the Arduino CLI. ```bash arduino-cli config set library.enable_unsafe_install true arduino-cli lib install --git-url "https://github.com/workloads/scservo.git" ``` -------------------------------- ### Basic Setup for SMS_STS Class Source: https://context7.com/workloads/scservo/llms.txt Initializes the SMS_STS servo controller for SMSBL, SMSCL, and STSCL series servos. The API is similar to the SCSCL class but includes support for acceleration parameters. This setup involves initializing serial communication and assigning the serial port to the `st` object. Requires the SCServo library. ```cpp #include #define S_RXD 18 #define S_TXD 19 SMS_STS st; void setup() { Serial.begin(115200); Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD); st.pSerial = &Serial1; delay(1000); } ``` -------------------------------- ### SCSCL Class - Basic Setup (ESP32) Source: https://context7.com/workloads/scservo/llms.txt Initializes the SCSCL servo controller by creating an instance and assigning a hardware serial port for communication with FIT serial servos over UART at 1Mbps. ```cpp #include // Define UART pins (ESP32) #define S_RXD 18 #define S_TXD 19 SCSCL sc; void setup() { Serial.begin(115200); // Debug output Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD); // Servo UART at 1Mbps sc.pSerial = &Serial1; // Assign serial port delay(1000); // Allow servos to initialize } ``` -------------------------------- ### SMS_STS Class - Basic Setup Source: https://context7.com/workloads/scservo/llms.txt Initializes the SMS_STS servo controller for SMSBL, SMSCL, and STSCL series servos. The API is similar to SCSCL but includes acceleration parameter support. ```APIDOC ## SMS_STS Class - Basic Setup ### Description Initializes the SMS_STS servo controller for SMSBL, SMSCL, and STSCL series servos. The API is similar to SCSCL but includes acceleration parameter support. ### Method - Constructor `SMS_STS()`: Initializes the SMS_STS object. ### Endpoint N/A (Library initialization) ### Parameters None for basic setup. ### Request Example ```cpp #define S_RXD 18 #define S_TXD 19 SMS_STS st; void setup() { Serial1.begin(1000000, SERIAL_8N1, S_RXD, S_TXD); st.pSerial = &Serial1; } ``` ### Response None (initialization is performed). ``` -------------------------------- ### GET /SMS_STS/FeedBack Source: https://context7.com/workloads/scservo/llms.txt Reads comprehensive status data from a servo, including position, speed, load, voltage, temperature, and current draw. ```APIDOC ## GET /SMS_STS/FeedBack ### Description Retrieves the current operational status of the specified servo. ### Method GET ### Endpoint /SMS_STS/FeedBack/{ID} ### Parameters #### Path Parameters - **ID** (byte) - Required - The unique identifier of the servo. ### Response #### Success Response (200) - **Position** (int) - Current position. - **Speed** (int) - Current speed. - **Load** (int) - Current load. - **Voltage** (int) - Current voltage. - **Temperature** (int) - Current temperature. - **Current** (int) - Current draw. ### Response Example { "Position": 2048, "Speed": 0, "Load": 10, "Voltage": 7400, "Temperature": 35, "Current": 150 } ``` -------------------------------- ### Read Servo Status with SCSCL::FeedBack Source: https://context7.com/workloads/scservo/llms.txt Reads servo status including position, speed, load, voltage, temperature, and movement state. It supports batch reading all parameters to a buffer using `FeedBack(ID)` and then retrieving them with ID=-1, or reading specific parameters directly by servo ID. Requires the SCServo library and serial communication setup. ```cpp #include SCSCL sc; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); Serial.begin(115200); sc.pSerial = &Serial1; delay(1000); } void loop() { int Pos, Speed, Load, Voltage, Temper, Move; // Method 1: Batch read all parameters to buffer, then retrieve if (sc.FeedBack(1) != -1) { Pos = sc.ReadPos(-1); // Position from buffer Speed = sc.ReadSpeed(-1); // Speed from buffer Load = sc.ReadLoad(-1); // Load (0-1000 percentage) Voltage = sc.ReadVoltage(-1); Temper = sc.ReadTemper(-1); // Temperature in Celsius Move = sc.ReadMove(-1); // 1 = moving, 0 = stopped Serial.print("Position: "); Serial.println(Pos); Serial.print("Speed: "); Serial.println(Speed); Serial.print("Load: "); Serial.println(Load); Serial.print("Voltage: "); Serial.println(Voltage); Serial.print("Temperature: "); Serial.println(Temper); Serial.print("Moving: "); Serial.println(Move); } else { Serial.println("FeedBack error"); } // Method 2: Direct read (no FeedBack call needed) Pos = sc.ReadPos(1); if (Pos != -1) { Serial.print("Direct Position: "); Serial.println(Pos); } else { Serial.println("Read position error"); } delay(500); } ``` -------------------------------- ### Control PWM Output with SCSCL::PWMMode and WritePWM Source: https://context7.com/workloads/scservo/llms.txt Enables PWM output mode for direct motor control. First, `PWMMode()` is called to configure the servo for PWM operation, and then `WritePWM()` is used to set the output values. Positive values indicate one direction, while negative values indicate the opposite direction. Requires the SCServo library and serial communication setup. ```cpp #include SCSCL sc; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); // Enable PWM mode for servo ID=1 sc.PWMMode(1); } void loop() { // WritePWM(ID, pwmValue) // Positive values = one direction, negative = opposite direction sc.WritePWM(1, 500); // 50% duty cycle forward delay(2000); sc.WritePWM(1, -500); // 50% duty cycle reverse delay(2000); sc.WritePWM(1, 0); // Stop delay(1000); } ``` -------------------------------- ### Detect Servo with SCSCL::Ping Source: https://context7.com/workloads/scservo/llms.txt Tests if a servo with a specific ID is present and responding on the bus. It returns the servo ID on success or -1 on failure. This function is useful for verifying servo connectivity and presence. Requires the SCServo library and serial communication setup. ```cpp #include SCSCL sc; int TEST_ID = 3; int LEDpin = 13; void setup() { pinMode(LEDpin, OUTPUT); digitalWrite(LEDpin, HIGH); Serial.begin(115200); Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); } void loop() { int ID = sc.Ping(TEST_ID); if (ID != -1) { digitalWrite(LEDpin, LOW); // LED on - servo found Serial.print("Servo ID: "); Serial.println(ID, DEC); delay(100); } else { Serial.println("Ping servo ID error!"); digitalWrite(LEDpin, HIGH); // LED off - servo not found delay(2000); } } ``` -------------------------------- ### Control Servo Torque with SCSCL::EnableTorque Source: https://context7.com/workloads/scservo/llms.txt Enables or disables the torque output of a servo. When torque is disabled, the servo can be freely moved by hand. The function takes the servo ID and an enable flag (1 for enable, 0 for disable). Requires the SCServo library and serial communication setup. ```cpp #include SCSCL sc; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); // EnableTorque(ID, Enable) sc.EnableTorque(1, 1); // Enable torque on servo ID=1 delay(2000); sc.EnableTorque(1, 0); // Disable torque - servo can move freely delay(2000); } void loop() {} ``` -------------------------------- ### Modify Servo ID with SCSCL EPROM Functions Source: https://context7.com/workloads/scservo/llms.txt Unlocks the servo's EPROM to allow modification of configuration parameters, such as the servo ID, and then relocks it. This function should be used with caution due to the limited write cycles of EPROM. It involves unlocking, writing the new byte, and then locking with the new ID. Requires the SCServo library and serial communication setup. ```cpp #include SCSCL sc; int ID_ChangeFrom = 1; int ID_ChangeTo = 2; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); // Change servo ID from 1 to 2 sc.unLockEprom(ID_ChangeFrom); // Unlock EPROM for writing sc.writeByte(ID_ChangeFrom, SCSCL_ID, ID_ChangeTo); // Write new ID sc.LockEprom(ID_ChangeTo); // Lock EPROM (use new ID) } void loop() {} ``` -------------------------------- ### SMS_STS::RegWritePosEx - Asynchronous Position Write (C++) Source: https://context7.com/workloads/scservo/llms.txt Queues position commands with acceleration for later synchronized execution, enabling coordinated multi-servo movements. Uses the SCServo library. ```cpp #include SMS_STS st; void setup() { Serial.begin(115200); Serial1.begin(1000000, SERIAL_8N1, 18, 19); st.pSerial = &Serial1; delay(1000); } void loop() { // RegWritePosEx(ID, Position, Speed, Acceleration) st.RegWritePosEx(1, 4095, 3400, 50); // Queue servo 1 st.RegWritePosEx(2, 4095, 3400, 50); // Queue servo 2 st.RegWriteAction(); // Execute simultaneously delay(3000); st.RegWritePosEx(1, 0, 3400, 50); st.RegWritePosEx(2, 0, 3400, 50); st.RegWriteAction(); delay(3000); } ``` -------------------------------- ### SMS_STS::WritePosEx - Position Control with Acceleration (C++) Source: https://context7.com/workloads/scservo/llms.txt Commands a single SMS/STS servo to move to a specified position with defined speed and acceleration. Supports high-resolution position values up to 4095. Requires the SCServo library. ```cpp #include SMS_STS st; void setup() { Serial.begin(115200); Serial1.begin(1000000, SERIAL_8N1, 18, 19); st.pSerial = &Serial1; delay(1000); } void loop() { // WritePosEx(ID, Position, Speed, Acceleration) st.WritePosEx(1, 4095, 3400, 50); // Move to position 4095, speed=3400, acc=50 delay(2000); st.WritePosEx(1, 2000, 1500, 50); // Move to position 2000, speed=1500, acc=50 delay(2000); } ``` -------------------------------- ### SCSCL::RegWritePos - Asynchronous Position Write Source: https://context7.com/workloads/scservo/llms.txt Queues position commands for multiple servos without immediate execution. Call `RegWriteAction()` to execute all queued commands simultaneously for synchronized movement. ```cpp #include SCSCL sc; void setup() { Serial.begin(115200); Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); } void loop() { // Queue position commands (not executed yet) // RegWritePos(ID, Position, Time, Speed) sc.RegWritePos(1, 1000, 0, 1500); // Queue servo 1 sc.RegWritePos(2, 1000, 0, 1500); // Queue servo 2 sc.RegWriteAction(); // Execute all queued commands simultaneously delay(754); // Move both servos back sc.RegWritePos(1, 20, 0, 1500); sc.RegWritePos(2, 20, 0, 1500); sc.RegWriteAction(); delay(754); } ``` -------------------------------- ### SMS_STS::SyncWritePosEx - Synchronized Multi-Servo Control (C++) Source: https://context7.com/workloads/scservo/llms.txt Sends position commands with individual acceleration values to multiple SMS/STS servos in a single packet for precise, synchronized motion. Requires the SCServo library. ```cpp #include SMS_STS st; byte ID[2]; s16 Position[2]; u16 Speed[2]; byte ACC[2]; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); st.pSerial = &Serial1; delay(1000); ID[0] = 1; ID[1] = 2; Speed[0] = 3400; Speed[1] = 3400; ACC[0] = 50; ACC[1] = 50; } void loop() { Position[0] = 3000; Position[1] = 3000; // SyncWritePosEx(IDs, count, Positions, Speeds, Accelerations) st.SyncWritePosEx(ID, 2, Position, Speed, ACC); delay(2000); Position[0] = 100; Position[1] = 100; st.SyncWritePosEx(ID, 2, Position, Speed, ACC); delay(2000); } ``` -------------------------------- ### POST /SMS_STS/SyncWritePosEx Source: https://context7.com/workloads/scservo/llms.txt Writes position commands to multiple SMS/STS servos simultaneously in a single communication packet. ```APIDOC ## POST /SMS_STS/SyncWritePosEx ### Description Executes synchronized movement for multiple servos by sending a single packet containing individual position, speed, and acceleration data. ### Method POST ### Endpoint /SMS_STS/SyncWritePosEx ### Parameters #### Request Body - **IDs** (byte[]) - Required - Array of servo IDs. - **count** (byte) - Required - Number of servos. - **Positions** (s16[]) - Required - Array of target positions. - **Speeds** (u16[]) - Required - Array of speeds. - **Accelerations** (byte[]) - Required - Array of acceleration values. ### Request Example { "IDs": [1, 2], "count": 2, "Positions": [3000, 3000], "Speeds": [3400, 3400], "Accelerations": [50, 50] } ``` -------------------------------- ### POST /SMS_STS/WritePosEx Source: https://context7.com/workloads/scservo/llms.txt Commands a single SMS/STS servo to move to a specific position with defined speed and acceleration. ```APIDOC ## POST /SMS_STS/WritePosEx ### Description Commands a single SMS/STS servo to move to a target position using specified speed and acceleration parameters. ### Method POST ### Endpoint /SMS_STS/WritePosEx ### Parameters #### Request Body - **ID** (byte) - Required - The unique identifier of the servo. - **Position** (u16) - Required - Target position (0-4095). - **Speed** (u16) - Required - Movement speed. - **Acceleration** (byte) - Required - Acceleration value. ### Request Example { "ID": 1, "Position": 4095, "Speed": 3400, "Acceleration": 50 } ``` -------------------------------- ### SMS_STS::FeedBack - Servo Status Monitoring (C++) Source: https://context7.com/workloads/scservo/llms.txt Reads comprehensive status information from SMS/STS servos, including position, speed, load, voltage, temperature, movement status, and current draw. Requires the SCServo library. ```cpp #include SMS_STS sms_sts; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); Serial.begin(115200); sms_sts.pSerial = &Serial1; delay(1000); } void loop() { int Pos, Speed, Load, Voltage, Temper, Move, Current; if (sms_sts.FeedBack(1) != -1) { Pos = sms_sts.ReadPos(-1); Speed = sms_sts.ReadSpeed(-1); Load = sms_sts.ReadLoad(-1); Voltage = sms_sts.ReadVoltage(-1); Temper = sms_sts.ReadTemper(-1); Move = sms_sts.ReadMove(-1); Current = sms_sts.ReadCurrent(-1); // Current reading available on SMS/STS Serial.print("Position: "); Serial.println(Pos); Serial.print("Speed: "); Serial.println(Speed); Serial.print("Load: "); Serial.println(Load); Serial.print("Voltage: "); Serial.println(Voltage); Serial.print("Temperature: "); Serial.println(Temper); Serial.print("Moving: "); Serial.println(Move); Serial.print("Current: "); Serial.println(Current); } else { Serial.println("FeedBack error"); } delay(500); } ``` -------------------------------- ### C++ SCS Base Class Low-Level Register Access Source: https://context7.com/workloads/scservo/llms.txt Demonstrates low-level byte and word read/write operations to servo registers using the SCS base class. It includes initialization of the serial port and error checking. ```cpp #include SCSCL sc; // or SMS_STS void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); // Low-level byte read/write int value = sc.readByte(1, SCSCL_PRESENT_VOLTAGE); // Read single register int word = sc.readWord(1, SCSCL_PRESENT_POSITION_L); // Read 2-byte value sc.writeByte(1, SCSCL_TORQUE_ENABLE, 1); // Write single byte sc.writeWord(1, SCSCL_GOAL_POSITION_L, 512); // Write 2-byte value // Check servo error status if (sc.Err) { Serial.println("Communication error occurred"); } } void loop() {} ``` -------------------------------- ### SCSCL::SyncWritePos - Synchronized Multi-Servo Control Source: https://context7.com/workloads/scservo/llms.txt Writes position commands to multiple servos in a single packet for efficient synchronized control. Requires arrays for IDs, positions, times, and speeds. ```cpp #include SCSCL sc; byte ID[2]; u16 Position[2]; u16 Speed[2]; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); // Configure servo IDs ID[0] = 1; ID[1] = 2; } void loop() { // Set target positions and speeds for both servos Position[0] = 1000; Position[1] = 1000; Speed[0] = 1500; Speed[1] = 1500; // SyncWritePos(IDs, count, Positions, Times, Speeds) sc.SyncWritePos(ID, 2, Position, 0, Speed); delay(754); // Move to different position Position[0] = 20; Position[1] = 20; sc.SyncWritePos(ID, 2, Position, 0, Speed); delay(754); } ``` -------------------------------- ### SMS_STS::WheelMode and WriteSpe - Continuous Rotation Control (C++) Source: https://context7.com/workloads/scservo/llms.txt Enables continuous rotation (wheel mode) for SMS/STS servos and controls their velocity. Allows for constant speed movement in either direction or stopping. Uses the SCServo library. ```cpp #include SMS_STS st; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); st.pSerial = &Serial1; delay(1000); // Enable wheel mode for continuous rotation st.WheelMode(1); } void loop() { // WriteSpe(ID, Speed, Acceleration) st.WriteSpe(1, 1000, 50); // Rotate at speed 1000 delay(3000); st.WriteSpe(1, -1000, 50); // Reverse direction delay(3000); st.WriteSpe(1, 0, 50); // Stop delay(1000); } ``` -------------------------------- ### SCSCL::PWMMode and WritePWM - PWM Output Control Source: https://context7.com/workloads/scservo/llms.txt Enables PWM output mode for direct motor control. First call `PWMMode()` to configure the servo, then use `WritePWM()` to set output values (positive or negative for direction). ```APIDOC ## SCSCL::PWMMode and WritePWM - PWM Output Control ### Description Enables PWM output mode for direct motor control. First call `PWMMode()` to configure the servo, then use `WritePWM()` to set output values (positive or negative for direction). ### Method - `PWMMode(int ID)`: Configures the servo with the specified ID to operate in PWM mode. - `WritePWM(int ID, int pwmValue)`: Sets the PWM output value for the servo. Positive values indicate one direction, negative values the opposite direction, and 0 stops the motor. ### Endpoint N/A (Library functions) ### Parameters - **ID** (int) - The ID of the servo to control. - **pwmValue** (int) - The PWM value (-1024 to 1024). 0 stops the motor. ### Request Example ```cpp sc.PWMMode(1); // Enable PWM mode for servo ID=1 sc.WritePWM(1, 500); // 50% duty cycle forward sc.WritePWM(1, -500); // 50% duty cycle reverse sc.WritePWM(1, 0); // Stop ``` ### Response None (operation is performed directly). ``` -------------------------------- ### SMS_STS::CalibrationOfs - Middle Position Calibration (C++) Source: https://context7.com/workloads/scservo/llms.txt Calibrates the middle/zero position for SMS/STS servos by setting the current physical orientation as the reference point. This function is part of the SCServo library. ```cpp #include SMS_STS st; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); st.pSerial = &Serial1; delay(1000); } void loop() { // Manually position servo to desired middle point, then call: st.CalibrationOfs(1); // Set current position as middle for servo ID=1 while(1); // Run once then stop } ``` -------------------------------- ### SCSCL::FeedBack and Read Functions - Status Monitoring Source: https://context7.com/workloads/scservo/llms.txt Reads servo status including position, speed, load, voltage, temperature, and movement state. Supports batch reading via FeedBack() or direct reading of individual parameters. ```APIDOC ## SCSCL::FeedBack and Read Functions - Status Monitoring ### Description Reads servo status including position, speed, load, voltage, temperature, and movement state. Use `FeedBack(ID)` to buffer all parameters, then read with ID=-1, or read directly with the servo ID. ### Method - `FeedBack(int ID)`: Buffers all servo parameters for a given servo ID. Returns -1 on error. - `ReadPos(int ID)`: Reads the current position. If ID is -1, reads from the buffer. - `ReadSpeed(int ID)`: Reads the current speed. If ID is -1, reads from the buffer. - `ReadLoad(int ID)`: Reads the current load (0-1000). If ID is -1, reads from the buffer. - `ReadVoltage(int ID)`: Reads the current voltage. If ID is -1, reads from the buffer. - `ReadTemper(int ID)`: Reads the current temperature in Celsius. If ID is -1, reads from the buffer. - `ReadMove(int ID)`: Reads the movement state (1=moving, 0=stopped). If ID is -1, reads from the buffer. ### Endpoint N/A (Library functions) ### Parameters - **ID** (int) - Servo ID for `FeedBack` or direct read. Use -1 to read from buffer after `FeedBack`. ### Request Example ```cpp // Method 1: Batch read if (sc.FeedBack(1) != -1) { Pos = sc.ReadPos(-1); Speed = sc.ReadSpeed(-1); // ... other reads } // Method 2: Direct read Pos = sc.ReadPos(1); ``` ### Response - **Position, Speed, Load, Voltage, Temperature, Move** (int) - Servo status parameters. Returns -1 on error for direct reads or if `FeedBack` fails. ``` -------------------------------- ### SCSCL EPROM Functions - ID and Configuration Changes Source: https://context7.com/workloads/scservo/llms.txt Unlocks EPROM to modify servo configuration (like ID), then locks it again. Use with caution as EPROM has limited write cycles. ```APIDOC ## SCSCL EPROM Functions - ID and Configuration Changes ### Description Unlocks EPROM to modify servo configuration (like ID), then locks it again. Use with caution as EPROM has limited write cycles. ### Method - `unLockEprom(int ID)`: Unlocks the EPROM for the specified servo ID, allowing configuration changes. - `writeByte(int ID, unsigned char Address, unsigned char Value)`: Writes a byte value to a specific EPROM address for the servo. - `LockEprom(int ID)`: Locks the EPROM for the specified servo ID, saving the changes. ### Endpoint N/A (Library functions) ### Parameters - **ID** (int) - The ID of the servo whose EPROM is being accessed. - **Address** (unsigned char) - The EPROM address to write to (e.g., `SCSCL_ID`). - **Value** (unsigned char) - The value to write to the specified address. ### Request Example ```cpp sc.unLockEprom(ID_ChangeFrom); // Unlock EPROM sc.writeByte(ID_ChangeFrom, SCSCL_ID, ID_ChangeTo); // Write new ID sc.LockEprom(ID_ChangeTo); // Lock EPROM with new ID ``` ### Response None (operation is performed directly). ``` -------------------------------- ### SCSCL::Ping - Servo Detection Source: https://context7.com/workloads/scservo/llms.txt Tests if a servo with a specific ID is present and responding on the bus. Returns the servo ID on success or -1 on failure. ```APIDOC ## SCSCL::Ping - Servo Detection ### Description Tests if a servo with a specific ID is present and responding on the bus. Returns the servo ID on success or -1 on failure. ### Method - `Ping(int ID)`: Sends a ping request to the specified servo ID. ### Endpoint N/A (Library functions) ### Parameters - **ID** (int) - The ID of the servo to ping. ### Request Example ```cpp int ID = sc.Ping(TEST_ID); if (ID != -1) { Serial.println("Servo found!"); } ``` ### Response - **ID** (int) - The servo ID if found, otherwise -1. ``` -------------------------------- ### SCSCL::EnableTorque - Torque Control Source: https://context7.com/workloads/scservo/llms.txt Enables or disables servo torque output. When disabled, the servo can be moved freely by hand. ```APIDOC ## SCSCL::EnableTorque - Torque Control ### Description Enables or disables servo torque output. When disabled, the servo can be moved freely by hand. ### Method - `EnableTorque(int ID, int Enable)`: Controls the torque output for the specified servo. ### Endpoint N/A (Library functions) ### Parameters - **ID** (int) - The ID of the servo. - **Enable** (int) - 1 to enable torque, 0 to disable torque. ### Request Example ```cpp sc.EnableTorque(1, 1); // Enable torque on servo ID=1 sc.EnableTorque(1, 0); // Disable torque ``` ### Response None (operation is performed directly). ``` -------------------------------- ### SCSCL::WritePos - Single Servo Position Control Source: https://context7.com/workloads/scservo/llms.txt Commands a single servo to move to a target position with specified time and speed. Supports individual servo control and broadcast to all servos using ID 0xfe. ```cpp #include SCSCL sc; void setup() { Serial1.begin(1000000, SERIAL_8N1, 18, 19); sc.pSerial = &Serial1; delay(1000); } void loop() { // WritePos(ID, Position, Time, Speed) // Move servo ID=1 to position 1000 at speed 1500 sc.WritePos(1, 1000, 0, 1500); delay(754); // Calculate delay: [(P1-P0)/V]*1000+100 // Move servo ID=1 to position 20 at speed 1500 sc.WritePos(1, 20, 0, 1500); delay(754); // Broadcast to ALL servos (ID=0xfe) sc.WritePos(0xfe, 1000, 0, 1500); delay(754); } ``` === COMPLETE CONTENT === This response contains all available snippets from this library. No additional content exists. Do not make further requests.