Case 6: Combined Action Programming – Dancing Robot
Case Introduction
Based on the understanding of sequential execution structures and loop structures, students will get familiar with dedicated action blocks and servo control blocks. Guided by existing programming knowledge, students will combine various blocks to write programs and realize robot dancing movements. This lesson further develops programming logical thinking, improves hands-on operation and creative design capabilities, and builds a solid foundation for advanced programming learning.
Teaching Preparation
| Name | Image |
|---|---|
| PU Robot Kit | ![]() |
| Programming Device (Computer) | |
| Flat Ground |
Course Objectives
On the basis of proficiently using basic blocks and loop modules, learn the functions and application methods of new action blocks, including the default built-in "dance" block and the custom block "set servo rotation angle".
Comprehensively apply sequential execution structures, loop modules and multiple action modules to write combined action programs and achieve coherent performance movements of the robot.
Learn to reasonably arrange action sequences and delay parameters to ensure smooth movement connection, and enhance program debugging capabilities.
Integrate artistic elements to cultivate creative design ability and team collaboration spirit, and improve the comprehensive application of MakeCode graphical programming.
Course Introduction
In the previous lesson, we learned to adjust action sequences, optimize delay parameters, and mastered the programming logic of sequential execution. Today, we will unlock a new skill for the robot — dancing! By applying loop structures, combined with dedicated action blocks and servo control blocks, we will create continuous dance choreography for the robot, turning it into a little dancer for a wonderful performance. Let’s see which team designs the most creative dance program!
Learning Exploration
Review Prior Knowledge: Guide students to review the sequential execution structure and basic blocks learned in Case 4. Raise questions: "What is a sequential execution structure? What dedicated action blocks have we learned? What role do delay blocks play in connecting different actions?" Invite students to demonstrate on stage to consolidate the use of logic for sequential execution, as well as blocks such as "when button A is pressed", "move straight", "kick leg" and "delay", laying a solid foundation for new knowledge.
New Module Learning: Focus on introducing servo control blocks (e.g., head servo rotation) and explain their functions. By adjusting the servo angle, students can change the robot’s head posture and enrich dance effects with coordinated dedicated actions. Demonstrate parameter settings of servo blocks, including rotation angle and speed, and explain how to drag and combine servo control blocks with action and delay blocks in order. Emphasize that reasonable delay settings are essential to ensure smooth transitions between servo movements and preset dance actions.
Dance Creation & Programming Exploration: Divide students into groups to discuss and design robot dance combinations based on sequential structures. The design must include dedicated action blocks, servo control blocks and delay blocks. Set "when button A is pressed" as the trigger condition to arrange coherent dance movements in sequence, such as head shaking → straight movement → jumping. Encourage students to innovate independently, arrange reasonable action order and delay values, and create highly entertaining robot dance performances.
MakeCode Programming
Program 1: Default Built-in Dance Program

Program Link: https://makecode.microbit.org/_diwPuMPuWCrT
Program 2: Program for Robot Head Shaking Movement

Program Link: https://makecode.microbit.org/_WjwRAuE4JcVr
Program 3: Custom Choreography (Head Shake → Move Straight → Jump)

Program Link: https://makecode.microbit.org/_5Hmb2HFsXDyu
Classroom Activity
Organize a robot dance programming challenge. Each team presents their customized robot dance performance in turn. Other teams observe and evaluate from two dimensions: whether the movements are smoothly connected, and what creative highlights the choreography has.
Summary & Sharing
Combined with students’ presentations, the teacher summarizes the key takeaways of this lesson. The integrated use of sequential structures, loop modules and diverse action modules enables the robot to perform richer and multi-layered combined movements. Reasonable delay configuration is the core guarantee for smooth performances. Looking ahead, the next lesson will introduce the "variable" module to realize more flexible and precise robot motion control.
