Syntax
ID=FTSCSmotorlist(COM1)
Input Parameter
COM1 : | | Already Open Serial Port |
Output Parameter
Examples
COM1=serialport("/dev/cu.usbserial-840",115200)
ID=FTSCSmotorlist(COM1)
Copyright 2024-2025 Tim C. Lueth. All rights reserved. The code is the property of Tim C. Lueth and may not be redistributed or modified without explicit written permission. This software may be used free of charge for academic research and teaching purposes only. Commercial use, redistribution, modification, or reverse engineering is strictly prohibited. Access to source code is restricted and granted only under specific agreements. For licensing inquiries or commercial use, please contact: Tim C. Lueth
Algorithm (Workflow)
This function, FTSCSmotorlist
, is designed to identify motor IDs connected to a FeeTEch URT-1 Board via a serial port. It systematically pings potential motor IDs ranging from 0 to 250 to determine which motors are connected.
Input Parameters
- COM1: This is an already open serial port object through which communication with the motors is established. It is expected to be configured and opened prior to calling this function.
Output Results
- ID: An array containing the IDs of the motors that are successfully detected and connected to the serial port.
Algorithm Steps
- Initialize an empty cell array
ID
and a counter k
to zero.
- Iterate over a range of potential motor IDs from 0 to 250.
- For each ID, display the progress using
showprogress
function.
- Generate a command using
FTSCScmd
with the current ID, and write this command to the serial port COM1
.
- Pause for 3 milliseconds to allow the motor to respond.
- Check if there are any bytes available to read from the serial port.
- If bytes are available, read them and process the response using
FTSCSdata
to extract the motor ID.
- Increment the counter
k
and store the detected ID in the ID
array.
- After completing the loop, convert the cell array
ID
to a regular array and return it.
Example Usage
To use this function, first open a serial port connection:
COM1 = serialport("/dev/cu.usbserial-840", 115200);
ID = FTSCSmotorlist(COM1);
This example opens a serial port at a baud rate of 115200 and then calls FTSCSmotorlist
to find connected motor IDs.
Algorithm explaination created using ChatGPT on 2025-08-19 00:12. (Please note: No guarantee for the correctness of this explanation)
Last html export of this page out of FM database by TL: 2025-09-21