Your First Program
Goal: make the hub show a smiley, say "Hello", then spin a motor one rotation. Five minutes.
How this site writes blocks
Word Blocks are drag-and-drop, so this site represents block stacks as indented text, one block per line:
when program starts ← yellow hat block from Events
display image [SMILE] ← Light category
play sound [Hello] ← Sound categorySquare brackets [ ] are the dropdown/input values on the block. When you see a stack like this, rebuild it in the app with the same-named blocks.
Setup
- Plug a motor into Port A.
- Create a new project, choose Word Blocks.
- Make sure the hub is connected.
The program
when program starts
display image [SMILE]
play sound [Hello]
run motor [A] [clockwise] for [1] rotations
turn off pixelsBlock by block:
| Block | Category | What it does |
|---|---|---|
| when program starts | Events | Program entry point. Every program needs at least one hat block |
| display image | Light | Shows the chosen pattern on the 5x5 light matrix |
| play sound | Sound | Plays a sound from the speaker/device |
| run motor A for 1 rotation | Motors | Turns the Port A motor one full rotation, finishing before the next block runs |
| turn off pixels | Light | Clears the light matrix |
Run it
Click Download & Run. You should see: smiley lights up → sound plays → motor turns one rotation → lights go out.
Motor didn't move?
- Check the motor is in Port A - the port in the program must match the actual wiring.
- Open the hub connection panel: is a motor detected on Port A?
- Push connectors all the way in; loose cables are the #1 problem.
Experiment
- Change
[1] rotationsto[720] degreesand observe (2 rotations). - Add a Motors
set speedblock before the movement, set it to 100%. - Try another image and another sound.
What you learned
- A program = a hat block (when to trigger) + a stack of blocks below (what to do)
- Blocks run top to bottom; most blocks finish their job before the next one starts
- Port letters must match the physical wiring
Next lesson: Motor Control - every way to use a motor.