Speed and power
Speed is set separately from movement. You tell the motor how fast it should go, and then you tell it to go — two blocks, in that order.
Blocks reference
| Block | What it does |
|---|---|
[A v] set speed to (25) % :: motors | Sets the speed for this motor from now on. Nothing moves — it only changes what the next movement will do. |
[A v] run [clockwise v] for (2) [rotations v] :: motors | Now moves, at whatever speed was last set. |
Set it first
when program starts :: events hat [A v] set speed to (25) % :: motors [A v] run [clockwise v] for (2) [rotations v] :: motors
Swap those two blocks round and the program still contains a speed of 25 % — it just never gets used. Both shafts below are asked for exactly 2 rotations; watch how long each one takes.
speed first — works
speed last — does nothing
Both shafts turn exactly 2 rotations. Only the time they take is different — and the right-hand program never gets the slow movement it was written to have.
The right-hand movement is over before the left is a third of the way round, because it ran at the default speed. Its set speed to () block does run — you can see it light up — but by then the movement it was meant to slow down has already happened. A speed block only ever affects the movements after it. This catches people out constantly.
Slow is often better
A high speed is not a better program. Slow movements are gentler on the gears, easier to watch and debug, and look more like the real machine — a barrier that snaps up in a fraction of a second reads as broken rather than fast.
More motion tutorials
- One motor, on and off — Start one motor, let it run, and stop it again.
- The Medium Motor — The small, fast motor that drives arms, gates, jaws and winches.
- The Large Motor — The big, strong motor used for wheels and heavy lifting.
- Driving with two motors — Drive a robot in a straight line, and turn it, using two Large Motors.
- Rotations and degrees — Measure how far a motor turns, so the same movement repeats exactly.
- Brake or coast — Stop a motor dead, or let it roll to a halt.
- Moving to an exact angle — Send a motor to an exact position instead of a distance from here.