Code It — Make It Move
By the end of today, you will…
- Write your first program using block code in the LEGO SPIKE app
- Make the motor spin forward, stop, and reverse
- Use a loop to repeat an action without copying blocks
- Each role contributes to making the robot move
Materials for Week 5
- SPIKE Essential kit with hub + motor + sensor connected
- Chromebooks with SPIKE app open (education.lego.com)
- Cable to connect hub
- Engineering notebooks
How block code works
Block coding is like giving step-by-step instructions to a robot. Each block is one instruction. The robot follows them top to bottom, in order. This is called a sequence.
3 things to know before you start
- Blocks snap together — if they won't connect, they're not compatible
- Run your program before making changes — the behavior may be different from what you expected, and observing it first helps narrow down what to adjust
- Change ONE thing at a time when testing — that way you know what caused the change
Activity: Put the sequence in order
Click the blocks in the correct order — 1st, 2nd, 3rd… Then press Check to see if you're right.
Teacher notes ▾
The quiz is meant to be done as a class on screen before students open the SPIKE app. Walk through Q1 together. Let students debate Q5 — there's a real-world reason you stop before reversing (it protects the motor).
This 5-minute discussion is worth more than 20 minutes of open coding time.
First programs
Technician leads coding. Operator handles the physical motor attachment. Driver plans what the movement should accomplish ("we need it to spin 2 rotations then stop"). Specialist documents each program version in the notebook.
Challenge 1
Open the LEGO SPIKE app (in Chrome at education.lego.com or the app). Connect the hub. Write a program that makes the motor spin forward for 2 seconds, then stop. Run it. Does it do what you expected?
Challenge 2
Now make it spin forward 2 seconds, stop, then spin backward 2 seconds. Run it. What happens if you remove the "stop" block between forward and backward?
Challenge 3 — loops
Make the motor do the forward-stop-backward sequence 3 times WITHOUT copying all the blocks. Use a loop block. How many total blocks do you need?
Challenge 4 — sensor
Add a touch sensor. The motor only starts when you press the sensor. What kind of block do you need? (Hint: it starts with "if")
Teacher notes ▾
The most common issue is the hub not connecting. Check that Bluetooth is on and the hub is turned on (press the center button). If the hub isn't found, try refreshing the page.
For Challenge 4, some teams will find the sensor block immediately; others won't. Rather than pointing to it, ask "what would you type into the search bar if you were looking for a block that waits for something to happen?"
Engineering notebook entry
Teacher notes ▾
The sketch-your-program prompt encourages students to think about their code structurally, which builds a deeper understanding of how the pieces connect.
This also supports debugging — having a visual reference makes it easier to spot where the logic may need adjustment.