Name each dance move as a function, then build a routine by calling them.
A dance crew learns named moves (the shuffle, the twirl), then a routine is just the names in order. Robot shows and drone light shows are built the same way.
In micro:bit Foundations you made functions: a named group of blocks that runs when you call it. A robot's moves are a good use for them: build each move once, give it a name, then a dance is just a list of names. You find functions in Advanced › Functions.
Make your prediction first. Help opens once you've locked it in.

function wiggle () {
robot.motorTank(50, -50, 300)
robot.motorTank(-50, 50, 300)
robot.motorStop()
}
input.onButtonPressed(Button.A, function () {
wiggle()
wiggle()
})
robot.elecfreaksCuteBot.start()
wiggle is a function: a quick turn right, a quick turn left, then stop.
Press A on the simulator's micro:bit. Press it again to dance again.

function wiggle () {
robot.motorTank(50, -50, 300)
robot.motorTank(-50, 50, 300)
robot.motorStop()
}
input.onButtonPressed(Button.A, function () {
wiggle()
wiggle()
})
robot.elecfreaksCuteBot.start()
This version has two moves: wiggle on A and spin on B.

function wiggle () {
robot.motorTank(50, -50, 300)
robot.motorTank(-50, 50, 300)
robot.motorStop()
}
function spin () {
robot.motorTank(50, -50, 1200)
robot.motorStop()
}
input.onButtonPressed(Button.A, function () {
wiggle()
wiggle()
})
input.onButtonPressed(Button.B, function () {
spin()
})
robot.elecfreaksCuteBot.start()
Press B and watch.
Leo's program:

function spin () {
robot.motorTank(50, -50, 1200)
robot.motorStop()
}
input.onButtonPressed(Button.A, function () {
robot.motorTank(50, 50, 1000)
robot.motorStop()
})
robot.elecfreaksCuteBot.start()
Make a second move: a function called spin that turns for 1200 ms, then stops. Make button B call it.
In Functions, click Make a Function and call it spin.
Inside it: robot motor tank 50 −50 for 1200 ms, then robot motor stop. Then put call spin inside on button B pressed.
Change button A so it dances wiggle, spin, wiggle.
Inside on button A pressed: call wiggle, call spin, call wiggle.
Make a spin function and call it from button B.
This ticks by itself when your blocks do what is asked.
Make A do a routine: wiggle, spin, wiggle.
This ticks by itself when your blocks do what is asked.
Make a dance routine for a robot show:
Name your moves so a reader can picture them, like shuffle or twirl.
Make two new functions, each a short move that ends with robot motor stop. Ideas: a shuffle (forward then back), a twirl (spin the other way).
Use on button A+B pressed (change A to A+B). Call your moves in order, using one of them twice.
A dance: at least two new moves of your own, and a routine on A+B that calls them, one move twice.
This ticks by itself when your blocks do what is asked.
Real robots dance differently from the simulator: on a smooth desk they slide, on carpet they turn less. Tune each move's times on your floor. Because each move is a function, you fix it in one place and every call in the routine gets the fix. Later in the course, music and radio cues let several robots dance together.
Students name robot moves as functions (wiggle, spin) and build a dance routine by calling them in order, revisiting functions from micro:bit Foundations in a new setting. About 45 minutes.
Open the teacher guide: answers, solutions, slides and a worksheet.
A function is a named group of blocks that runs when it is called. Students met functions in micro:bit Foundations (flashHeart); here each function is a move: a few motor blocks that end with robot motor stop. A routine is then a list of calls, which is easy to read and easy to change. The classic slip returns: making a function does nothing until something calls it (Leo's robot).
Functions are in Advanced › Functions (Make a Function…, then a call block appears). Each move should end with robot motor stop, or the next move starts from a moving robot. MOVE Motor classes can build the same moves from the Kitronik blocks with pauses.
Making a function doesn't move the robot; calling it does. When nothing happens, ask where the call block is.
Stretch: Add robot set color to each move so the lights change with the dance, or play a tone at the start of each move.
Support: Give students the shuffle function made; they make one more move and the A+B routine.
Next unit: Sense. Later, lesson 8 uses radio so one micro:bit can cue several robots to dance together. Class idea: a short robot dance-off, with each group's routine read aloud as a list of move names first.