Case 5: Combined Action Programming – Dancing Robot
Case Introduction
Based on understanding the sequential execution structure, students will become familiar with the "perform specified action" blocks and servo control blocks. Guided by their existing programming foundation, students will combine various blocks to write programs and realize robot dance moves. This lesson deepens programming logical thinking, improves hands-on practice and creative design abilities, and lays a foundation for advanced programming in later stages.
Teaching Preparation
| Name | Diagram |
|---|---|
| PU Robot Kit | ![]() |
| Programming Device (Computer) | |
| Flat Ground |
Course Objectives
- Consolidate the programming logic of the sequential execution structure and understand the core principle that "instructions are executed in order";
- Become familiar with the functions and usage of specified action blocks (such as walking straight, kicking) and servo control blocks (such as head servo rotation);
- Be able to combine specified actions and servo control blocks with the sequential execution structure to write programs for robot dance moves;
- Improve program writing, debugging and creative design abilities, and deepen the understanding and application of MakeCode graphical programming.
Course Introduction
In the last class, 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! Using the sequential execution structure, combined with specified action blocks and servo control blocks, we will choreograph smooth dance moves for the robot, turning it into a little dancer to put on a wonderful performance. Let’s see which group creates the most creative dance program!
Learning Exploration
Review of Previous Knowledge: Guide students to review the sequential execution structure and existing blocks learned in Case 4. Ask: "What is a sequential execution structure? What specified action blocks have we mastered? What role does the pause block play in connecting actions?" Invite students to demonstrate on stage to consolidate the sequential logic and usage of blocks such as "when button A is pressed", "walk straight", "kick" and "pause", preparing for new content.
New Block Learning: Focus on introducing servo control blocks (such as head servo rotation). Explain their function: adjusting the robot’s head posture by controlling servo angles to enrich dance effects together with specified action blocks. Demonstrate parameter settings of servo control blocks (such as rotation angle and speed), and how to drag and combine them with specified action blocks and pause blocks in order. Clarify that "reasonable delays are required when connecting servo control and specified actions to ensure smooth dance moves".
Dance Creation & Programming Exploration: Guide students to discuss in groups and design robot dance combinations based on the sequential execution structure. The program must include specified action blocks, servo control blocks and pause blocks, triggered by "when button A is pressed", with smooth choreographed moves in order (e.g., head turn → nod → kick → walk straight → turn → kick). Encourage creative design with reasonable action order and delay parameters for better visual effect.
Makecode Programming
Program 1: Default Dance (Moves can be adjusted to match music rhythm)

Program Link: https://makecode.microbit.org/_diwPuMPuWCrT
Program 2: Programmed Head Shaking Motion

Program Link: https://makecode.microbit.org/_bTf0aYV0MRyy
Summary & Sharing
Invite each group to share their programming experience and observations from class activities. Based on students’ sharing, the teacher briefly explains sequential program execution and the function of the pause block.
