Skip to content

EM: Configure Motor: EXP Bus Protocol Reference

This command is used to configure one of the motors attached to the expansion board.

Command syntax

EM:<motor>,<type>,<max_ms>[,<params>]

<motor>

The index of the motor you want to configure, in hex. Valid motors numbers vary by board type, but there are a maximum of motors per breakout on the board.

<type>

Sets the specific type of motor. * 1 Servo motor * 2 Stepper motor * 3 Shaker motor * 4 Haptic feedback * 5 Basic DC motor

<max_ms>

Sets the index of the first LED allocated to the port. Valid LED indices are 0-127 (0-7F hex).

<params>

Set various parameters dependent on the type of motor being configured.

Servo params

<min_pulse><max_pulse><neutral_pulse>

<min_pulse>

Pulse time in µS, for the servo to move to its minimum position. Default is 1000 (3E8 hex).

<max_pulse>

Pulse time in µS, for the servo to move to its minimum position. Default is 2000 (7D0 hex).

<neutral_pulse>

Pulse time in µS, for the servo to move to its minimum position. Default is 1500 (5DC hex).

Stepper params

<step_rate><flags>

<step_rate>

Pulse time in µS, for the servo to move to its minimum position. Default is 1000 (3E8 hex).

<flags>

Pulse time in µS, for the servo to move to its minimum position. Default is 2000 (7D0 hex).

Shaker params

<step_rate><flags>

<step_rate>

Number of steps per second. Default is 600 (258 hex).

<flags>

Bit flags for adjusting stepper behavior. STEPPER_COUNT_MS = 0x01 STEPPER_DIR_REVERSE = 0x02 STEPPER_HOME_NC = 0x04 STEPPER_LIMIT_NC = 0x08

Returns

  • EM:P means the motor configuration was successful.
  • EM:F means the motor configuration failed.

N or > jump the next page, P or < for previous, search with S or ?