4.4. Setting up USB control
This section explains how to control the Tic over USB.
If you have not done so already, you should follow the instructions in Section 4.3 to configure and test your stepper motor. You should leave your Tic’s control mode set to “Serial / I²C / USB” (the default). That section also shows how to control the Tic over USB using the Tic Control Center software. If the Tic Control Center’s graphical user interface is good enough for you, you do not need to set up anything else and can skip the rest of this section.
Another option for controlling the Tic over USB is to use the Tic Command-line Utility,
ticcmd. You can either run the utility directly by typing commands in your command prompt (shell), or you can write your own software that runs it.
To try out
ticcmd, you should open a new command prompt and run
ticcmd without any arguments. This causes
ticcmd to print out a help screen listing all the options it supports. You can combine multiple options in one invocation.
If your command prompt prints out a message indicating that
ticcmd is not found or not recognized, make sure you have installed the Tic software properly as described earlier in this guide. Also, make sure that the directory containing the
ticcmd executable is in your PATH environment variable, and try starting a new command prompt or terminal after installing the software.
To set the target position or velocity of the Tic, try running these commands:
ticcmd --exit-safe-start --position 400 ticcmd --exit-safe-start --velocity 2000000
--position option can be abbreviated as
--velocity can be abbreviated as
If the commands above do not produce movement, you should run
ticcmd --status to print out the errors that are currently stopping the motor. This might tell you what is going wrong.
On Microsoft Windows, only one device can access the Tic’s USB interface at a time, so you will need to close the Tic Control Center software before running
You might notice that the Tic only performs the desired movement for about a second before it stops moving and the red LED turns on, indicating an error. This is because of the Tic’s command timeout feature: by default, the Tic’s “Command timeout” error will happen if it does not receive certain commands periodically (see Section 5.4 for details), causing the motor to stop. You can run
ticcmd --reset-command-timeout every second to get around this, or you can disable the command timeout feature using the Tic Control Center: uncheck the “Enable command timeout” checkbox in the “Serial” box.
To get the current status of the Tic, try running these commands, which give different levels of detail:
ticcmd --status ticcmd --status --full
The output of these commands is designed to be compatible with the YAML format, so if you are writing a computer program that needs to get some information from the Tic, you can parse the output with a YAML parser in the language of your choice.
If you have multiple Tics connected to the computer, you will need to use the
-d option to specify the serial number of the device you want to use. For example, to get the status of the Tic with serial number 12345678, run
ticcmd -d 12345678 --status. You can run
ticcmd --list to get the serial numbers (they are listed in the first column). If you omit the
ticcmd will print: “Error: There are multiple qualifying devices connected to this computer. Use the -d option to specify which device you want to use, or disconnect the others.”
For more details about the commands you can send to the Tic over USB, see Section 8.
If you want to write your own software to control the Tic instead of just using
ticcmd or the Tic Control Center, see Section 12.