Events
The yellow hat blocks in the Events category decide when a stack of blocks starts running. No hat block, no execution.
Common hat blocks
wordblocks
when program starts
when [left] button [pressed]
when hub [shaken]
when <condition>
when I receive [message1]| Hat | Fires when |
|---|---|
| when program starts | The moment you hit run / start the slot - the most used |
| when button pressed | Hub left/right button, great for manual debug triggers |
| when shaken | Hub detects a shake/tap |
| when <condition> | The condition flips from false to true (e.g. sensor crosses a threshold) |
| when I receive | A broadcast [message] block sent this message |
Parallel stacks
One project can hold multiple hat blocks, each running independently and simultaneously:
wordblocks
when program starts
set movement motors [A+E]
move [forward] for [5] rotations
when program starts ← second stack, runs at the same time
forever
display image [HEART]
wait [0.5] seconds
turn off pixels
wait [0.5] secondsThe robot drives while the light blinks - the simplest form of concurrency.
Don't fight over one motor
Two stacks commanding the same motor produce unpredictable results. Give each parallel stack its own resources: one owns the drive base, another owns lights/attachments.
Broadcasts: signals between stacks
wordblocks
when program starts
move [forward] for [3] rotations
broadcast [arrived]
when I receive [arrived]
run motor [C] [clockwise] for [180] degreesBroadcasts chain stacks together: when the base arrives, tell the arm to move. In complex competition programs, staging with broadcasts is clearer than one giant stack.
FLL usage
- Debugging: hang "attachment to zero" under "when left button pressed" - one press at the table resets the arm.
- Starting: the rules require the robot to run autonomously once launched (no remote control) - they don't prescribe how you start programs. The common workflow is one program slot per launch: left/right to pick, center to start. No extra events needed.
- Multi-mission programs: one slot per launch (run), not event-based switching.
Exercises
- Write two parallel stacks: one keeps a motor spinning, the other cycles light patterns every second.
- Use a broadcast: drive 2 rotations → broadcast → the receiving stack shows a checkmark.
Next lesson: Loops & Conditions.