pxt-ev3/docs/reference/motors/motor/set-run-phase.md
Peli de Halleux def648a98b
Block updates follow blog post (#905)
* fix battery block comment

* update run phase blocks

* some more docs
2019-09-06 06:22:12 -07:00

789 B

Set Run Phase

Allows to specify an acceleration or deceleration phases for run commands.

motors.largeD.setRunPhase(MovePhase.Acceleration, 1, MoveUnit.Seconds)

Once the run phase is specified on a motor (or pair of motors), it will be automatically applied to run commands.

Time vs Rotation

The phases specified for time units (seconds, milliseconds) only apply to run with time moves. Similarly, the phases specified for rotation units (# rotation, degrees) only apply to run with rotation units.

Examples

motors.largeB.setRunPhase(MovePhase.Acceleration, 0.5, MoveUnit.Seconds)
motors.largeB.setRunPhase(MovePhase.Deceleration, 0.2, MoveUnit.Seconds)
forever(function () {
    motors.largeB.run(50, 1, MoveUnit.Seconds)
})