Motor Control
Motors category blocks control a single motor - typically arms, claws and other attachments. Drive-base movement uses the Movement blocks covered next lesson.
Core blocks
run motor [A] [clockwise] for [1] rotations
run motor [A] [clockwise] for [90] degrees
motor [A] go to position [0]
start motor [A] [clockwise]
stop motor [A]
set motor [A] speed to [75] %| Block | Behavior | When to use |
|---|---|---|
| run for rotations / degrees | Turns a set amount, blocks until done | Attachment moves: raise arm 90°, close claw half a turn |
| go to position x | Moves to an absolute position (0-359), shortest path | Return an arm to the exact same pose every time |
| start motor | Starts spinning, next block runs immediately (non-blocking) | Pair with sensors: spin while waiting for a condition |
| stop motor | Stops a started motor | Always paired with "start" |
| set speed | Sets speed (0-100%) for subsequent moves | Slow and steady for attachments |
Blocking vs non-blocking
The concept beginners mix up most:
- "run for 1 rotation" blocks: the program waits on this block until the rotation finishes.
- "start motor" doesn't block: the motor starts and the program immediately moves on.
start motor [A] [clockwise]
wait [2] seconds ← Control category
stop motor [A]This means "spin for 2 seconds, then stop". Swap "start" for "run for 1 rotation" and the wait happens after the rotation instead.
Position and zeroing
Every motor has an absolute scale: a 0-mark on the housing. Related blocks:
motor [A] go to position [0] ← return to the 0 mark
(motor [A] position) ← round reporter block from SensorsFLL technique: attachment initialization
At the start of every run, send attachment motors to go to position [0] so the starting pose is identical every time. Hand-positioning an arm is not repeatable; zero it in the program.
Stop modes
A motor can stop three ways (set via block options or "set motor stop mode"):
| Mode | Effect |
|---|---|
| Brake | Stops firmly, the default |
| Hold | Stops and actively resists external force |
| Coast | Cuts power, spins down freely |
An arm lifting a load should use Hold, otherwise gravity pushes it back down after stopping.
Exercises
- Run the Port A motor 3 rotations at 30% speed, then 3 back at 100% - compare the time.
- Implement "spin 5 seconds" using start + wait + stop.
- Align the motor's 0-mark somewhere meaningful, put
go to position 0at the start of the program, run repeatedly and verify the pose is identical.
Next lesson: Movement (Drive Base).