Skip to content

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 category

Square 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

  1. Plug a motor into Port A.
  2. Create a new project, choose Word Blocks.
  3. 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 pixels

Block by block:

BlockCategoryWhat it does
when program startsEventsProgram entry point. Every program needs at least one hat block
display imageLightShows the chosen pattern on the 5x5 light matrix
play soundSoundPlays a sound from the speaker/device
run motor A for 1 rotationMotorsTurns the Port A motor one full rotation, finishing before the next block runs
turn off pixelsLightClears 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

  1. Change [1] rotations to [720] degrees and observe (2 rotations).
  2. Add a Motors set speed block before the movement, set it to 100%.
  3. 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.