Motion#

Spin#

The Spin block is used to spin a motor or motor group indefinitely.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A notched light blue coding block with the text "spin Motor1 forward" written in white. There are two dropdown menus: one labeled "Motor1" and the other labeled "forward.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "spin Motor1 forward" written in white. There are two dropdown menus: one labeled "Motor1" and the other labeled "forward." Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

Select which direction for the motor or motor group to move in.

A notched light blue coding block with a yellow highlight around it containing the text "spin Motor1 forward" written in white. There are two dropdown menus: one labeled "Motor1" and the other labeled "forward." Below the block, an expanded dropdown menu shows the options "forward" (with a checkmark) and "reverse.

In this example, the motor will spin forward for 1 second before stopping.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a light blue block reads "spin Motor1 forward," with "Motor1" and "forward" in dropdown menus. Following that is an orange block that reads "wait 1 seconds," with the number "1" in a white oval. The sequence ends with a light blue block that reads "stop Motor1," with "Motor1" in a dropdown menu.

Spin for#

The Spin for block is used to spin a motor or motor group for a given distance.

This is can be a non-blocking or blocking block depending on if the and don’t wait option is used.

A notched light blue coding block with the text "spin Motor1 forward for 90 degrees" written in white. There are four elements: a dropdown menu labeled "Motor1," a dropdown menu labeled "forward," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." A small arrow points to the right at the end of the block.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "spin Motor1 forward for 90 degrees" written in white. There are four elements: a dropdown menu labeled "Motor1," a dropdown menu labeled "forward," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

Select which direction for the motor or motor group to move in.

A notched light blue coding block with a yellow highlight around it containing the text "spin Motor1 forward for 90 degrees" written in white. There are four elements: a dropdown menu labeled "Motor1," a dropdown menu labeled "forward," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "forward" (with a checkmark) and "reverse.

Set how far the motor or motor group will spin by entering a value, and choosing the unit of measurement (degrees or turns).

A notched light blue coding block with a yellow highlight around it containing the text "spin Motor1 forward for 90 degrees" written in white. There are four elements: a dropdown menu labeled "Motor1," a dropdown menu labeled "forward," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "degrees" (with a checkmark) and "turns.

By default, the Spin for block will block any subsequent blocks from executing until it’s finished. By expanding the Spin for block to show and don’t wait, blocks will continue to execute while the motor or motor group is moving.

A notched light blue coding block with the text "spin Motor1 forward for 1 turns and don't wait" written in white. There are four elements: a dropdown menu labeled "Motor1," a dropdown menu labeled "forward," the number "1" displayed in a white oval, and a dropdown menu labeled "turns." The block ends with the phrase "and don't wait," with a small arrow pointing to the left before it.

In this example, the motor will spin forward for 1 turn.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a light blue block reads "spin Motor1 forward for 1 turns," with "Motor1," "forward," and "turns" in dropdown menus, and the number "1" displayed in a white oval. A small arrow points to the right at the end of the block.

Spin to position#

The Spin to position block is used to spin a motor or motor group to a set position.

This is can be a non-blocking or blocking block depending on if the and don’t wait option is used.

A notched light blue coding block with the text "spin Motor1 to position 90 degrees" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." A small arrow points to the right at the end of the block.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "spin Motor1 to position 90 degrees" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

Set how far the motor or motor group will spin by entering a value, and choosing the unit of measurement (degrees or turns).

A notched light blue coding block with a yellow highlight around it containing the text "spin Motor1 to position 90 degrees" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." A small arrow points to the right at the end of the block. Below the block, an expanded dropdown menu shows the options "degrees" (with a checkmark) and "turns.

By default, the Spin to position block will block any subsequent blocks from executing until it’s finished. By expanding the Spin to position block to show and don’t wait, blocks will continue to execute while the motor is moving.

A notched light blue coding block with the text "spin Motor1 to position 90 degrees and don't wait" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "90" displayed in a white oval, and a dropdown menu labeled "degrees." The block ends with the phrase "and don't wait," with a small arrow pointing to the left before it.

In this example, the motor will spin to the 270 degrees position.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a light blue block reads "spin Motor1 to position 270 degrees," with "Motor1" and "degrees" in dropdown menus, and the number "270" displayed in a white oval. A small arrow points to the right at the end of the block.

Stop Motor#

The Stop Motor block is used to stop the motor or motor group from moving.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A notched light blue coding block with the text "stop Motor1" written in white. There is a dropdown menu labeled "Motor1" on the right side of the block.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "stop Motor1" written in white. There is a dropdown menu labeled "Motor1" on the right side of the block. Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

In this example, the intake motors will spin in the intake direction for 1 second before stopping.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a light blue block reads "spin Motor1 forward," with "Motor1" and "forward" in dropdown menus. Following that is an orange block that reads "wait 1 seconds," with the number "1" in a white oval. The sequence ends with a light blue block that reads "stop Motor1," with "Motor1" in a dropdown menu.

Set Motor position#

The Set Motor position block is used to set a motor or motor group’s encoder position(s) to the entered value.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A notched light blue coding block with the text "set Motor1 position to 0 degrees" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "0" displayed in a white oval, and a dropdown menu labeled "degrees.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "set Motor1 position to 0 degrees" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "0" displayed in a white oval, and a dropdown menu labeled "degrees." Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

Set the unit of measurement to use, degrees or turns.

A notched light blue coding block with a yellow highlight around it containing the text "set Motor1 position to 0 degrees" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "0" displayed in a white oval, and a dropdown menu labeled "degrees." Below the block, an expanded dropdown menu shows the options "degrees" (with a checkmark) and "turns.

In this example, the motor’s encoder position is set to 90 degrees before the motor spins to the 0 degrees position.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a light blue block reads "set Motor1 position to 90 degrees," with "Motor1" and "degrees" in dropdown menus, and the number "90" displayed in a white oval. Following that is another light blue block that reads "spin MotorGroup2 to position 0 degrees," with "MotorGroup2" and "degrees" in dropdown menus, and the number "0" displayed in a white oval. A small arrow points to the right at the end of the block.

Set Motor velocity#

The Set Motor velocity block is used to set the speed of a motor or motor group.

This is a non-blocking block and allows any subsequent blocks to execute without delay.

A notched light blue coding block with the text "set Motor1 velocity to 50%" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "50" displayed in a white oval, and a dropdown menu labeled "%.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "set Motor1 velocity to 50%" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "50" displayed in a white oval, and a dropdown menu labeled "%." Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

The Set Motor velocity block will accept a range of -100% to 100%.

In this example, the motor will spin forward for 1 turn before setting the motor’s velocity to 75% before it spins in reverse for 1 turn.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a light blue block reads "spin Motor1 forward for 1 turns," with "Motor1," "forward," and "turns" in dropdown menus, and the number "1" displayed in a white oval. Following that is another light blue block that reads "set Motor1 velocity to 75%," with "Motor1" in a dropdown menu, the number "75" displayed in a white oval, and a "%" symbol in a dropdown menu. The sequence ends with a light blue block that reads "spin Motor1 reverse for 1 turns," with "Motor1," "reverse," and "turns" in dropdown menus, and the number "1" displayed in a white oval. A small arrow points to the right at the end of the block.

Set Motor Stopping#

The Set Motor Stopping block is used to set the behavior of the motor or motor group when they stop moving.

A notched light blue coding block with the text "set Motor1 stopping to brake" written in white. There are two dropdown menus: one labeled "Motor1" and the other labeled "brake.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "set Motor1 stopping to brake" written in white. There are two dropdown menus: one labeled "Motor1" and the other labeled "brake." Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

Select which stopping behavior to use.

The three drive stopping behaviors are as follows:

  • Brake - The motor or motor group will come to an immediate stop.

  • Coast - The motor or motor group will spin gradually to a stop.

  • Hold - The motor or motor group will come to an immediate stop. If the motor or motor group is rotated by an outside force, the built-in encoder will move the motor or motor group back to its initial stopped position.

A notched light blue coding block with a yellow highlight around it containing the text "set Motor1 stopping to brake" written in white. There are two dropdown menus: one labeled "Motor1" and the other labeled "brake." Below the block, an expanded dropdown menu shows the options "brake" (with a checkmark), "coast," and "hold.

In this example, the motor moves for 2 seconds before coasting to a stop.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a gray block reads, "Set the motor's stopping mode to coast." Following that is a light blue block that reads "set Motor1 stopping to coast," with "Motor1" and "coast" in dropdown menus. Another gray block follows, reading, "Spin the motor forward for 2 seconds before stopping." Next, a light blue block reads "spin Motor1 forward," with "Motor1" and "forward" in dropdown menus. An orange block that reads "wait 2 seconds" follows, with the number "2" displayed in a white oval. The sequence ends with a light blue block that reads "stop Motor1," with "Motor1" in a dropdown menu.

Set Motor Max Torque#

The Set Motor Max Torque block is used to set the strength of the Smart Motor or motor group. This block accepts a range of 0% to 100%.

A notched light blue coding block with the text "set Motor1 max torque to 50%" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "50" displayed in a white oval, and a dropdown menu labeled "%.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "set Motor1 max torque to 50%" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "50" displayed in a white oval, and a dropdown menu labeled "%." Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

In this example, the motor’s torque is set to 80% before spinning to the 350 degree position.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a light blue block reads "set Motor1 max torque to 80%," with "Motor1" in a dropdown menu, the number "80" displayed in a white oval, and a "%" symbol in a dropdown menu. Following that is another light blue block that reads "spin Motor1 to position 350 degrees," with "Motor1" and "degrees" in dropdown menus, and the number "350" displayed in a white oval. A small arrow points to the right at the end of the block.

Set Motor timeout#

The Set Motor timeout block is used to set a time limit for Smart Motor or motor group’s movement blocks.

The motor or motor group’s time limit is used to prevent motion blocks that do not reach their position from preventing other blocks in the stack from running. An example of a motor or motor group not reaching its position is an arm or claw that reaches its mechanical limit and cannot complete its movement.

A notched light blue coding block with the text "set Motor1 timeout to 1 seconds" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "1" displayed in a white oval, and a dropdown menu labeled "seconds.

Select which motor or motor group to use.

A notched light blue coding block with a yellow highlight around it containing the text "set Motor1 timeout to 1 seconds" written in white. There are three elements: a dropdown menu labeled "Motor1," the number "1" displayed in a white oval, and a dropdown menu labeled "seconds." Below the block, an expanded dropdown menu shows the options "Motor1" (with a checkmark) and "MotorGroup2.

In this example, the motor is set to spin forward for 5 turns with a timeout of 1 second. The motor won’t reach the target position within 1 second, so the Spin block will automatically stop, and the motor will return to the 0 degrees position.

A stack of coding blocks starting with a yellow "when started" block at the top. Below it, a gray block reads, "Set the motor's timeout to 1 second." Following that is a light blue block that reads "set Motor1 timeout to 1 seconds," with "Motor1" in a dropdown menu, the number "1" displayed in a white oval, and a "%" symbol in a dropdown menu. Below that is another light blue block that reads "spin Motor1 forward for 5 turns," with "Motor1," "forward," and "turns" in dropdown menus, and the number "5" displayed in a white oval. The sequence ends with a light blue block that reads "spin Motor1 to position 0 degrees," with "Motor1" and "degrees" in dropdown menus, and the number "0" displayed in a white oval. Small arrows point to the right at the end of the last two blocks.