Explorer: Drive a square
The lesson teaches how to combine driving commands so that the eXperiBot travels along geometric figures.

Learn how your eXperiBot can drive a square.
Learning goals
Overall learning objective (overarching)
Students develop a functional program that allows the eXperiBot to drive a square. They use appropriate motor commands, execute the necessary driving and turning movements, and integrate a counting loop for efficient repetition of statements. In doing so, they understand the importance of control structures for the automation of recurring processes.
Knowledge-related learning goals (cognitive)
Students will be able to…
Break down the “Drive a square” movement into individual steps and describe them as precise instructions.
explain how to implement repetitive processes using a counting loop.
analyze which programming blocks from the “Motor” and “Loops” categories are required and how they interact.
Skill-related learning goals (procedural)
Students can…
create a program that makes the eXperiBot drive a square using a counting loop.
correctly use appropriate blocks from the “Motor” and “Loops” categories.
test their program, identify errors, and optimize the code to ensure the desired sequence.
Attitude-related learning goals (affective)
Students…
demonstrate perseverance and remain motivated when attempts fail by reflecting on and improving their programs.
recognize the advantage of control structures such as counting loops for the efficiency and clarity of programs.
Prior learning
Learners can:
operate the programming environment (select blocks, start/stop program),
use simple statements from the “Motor” category (e.g., “Motor drive forward,” “Motor turn to…”),
create sequences (multiple statements in the correct order),
make the eXperiBot drive straight ahead and turn,
adjust driving times,
play a sound with the Powerbrain.
use the Infinite Loop to automate repetitive movements.
You should ideally complete the following lessons in advance:
First steps (introduction to the programming environment and getting to know the Powerbrain),
Travel movements (basic statements from the “Motor” category and Sequences).
Drive back and forth (implementing repetitive movements using the Infinite Loop for automation).
Lesson planning
The lesson introduces the control structure counting loop.
Introduction (approx. 10 minutes)
Method: Class discussion in plenary session
Story for starting the lesson: Robots in the warehouse
“Imagine a massive warehouse: shelves full of packages are stacked everywhere and robots dart back and forth between the aisles. They drive autonomously, stop at specific points, turn skillfully, and take new routes. For them to navigate around shelves, they need fixed routes—for example, in the form of a square.”
Stimulating questions for classroom discussion
Why do large companies use robots in their warehouses?
They save time and work around the clock.
They reduce errors.
They relieve people of difficult tasks.
What happens if a robot in the warehouse does not move precisely or turn correctly?
It bumps into shelves, blocks pathways, causes damage, or delays.
What movements must a robot master to navigate around shelves safely?
Drive forward, stop, turn at a specific angle, then repeat the sequence.
Transition to the lesson “Drive a square”
Formulate the task: Today, your eXperiBot will become a warehouse robot! To achieve this, work through the lesson “Drive a square” in the eXperiBot Blockly app.
Independent study of the lesson (approx. 25 minutes)
Method: Independent programming on the robot
Learners complete the units in their preferred working method—step by step or independently—and at their own pace, depending on how many units they can complete.
We set a 25-minute time limit, assuming that all students will meet the minimum requirements. This means that they should complete all units; bonus units are optional, and students can complete them depending on their pace and the time available.
The time required for the first unit (10 minutes)—assembling the eXperiBot and getting it ready to go—may vary depending on the students’ prior experience. In later lessons, this part is usually completed more quickly, as the students are already familiar with the assembly process.
Reflection phase (approx. 10 minutes)
Method: Class discussion in plenary session
Expected outcome of reflection
Learners recognize the importance of control structures (counting loops).
Learners understand how the program structure influences the robot’s behavior.
Learners can establish the connection to real-world applications.
Key questions
Explain why you used a counting loop.
We use a counting loop because the sequence repeats four times, which keeps the code shorter and better structured.
The learners explain that the counting loop automatically repeats the four driving and turning movements for the square. Without this loop, they would need to write each statement multiple times individually, which would make the code longer and more confusing.
Compare your program with the behavior of a real warehouse robot.
Both follow fixed procedures, must drive precisely, and turn correctly to avoid obstacles; real robots have additional sensors (obstacle detection).
Learners should identify similarities and differences: Both drive between fixed points, stop, and perform an action (e.g., give a signal). However, a real warehouse robot also has sensors for obstacle detection and can react flexibly to changes, while the eXperiBot strictly follows the programmed sequence.
Evaluate how efficient your program is: Is it readable? Does it use few blocks, and does it work reliably?
A program is efficient if it requires few blocks, is easy to read, and can be easily adapted.
Learners should recognize that a program is efficient if it uses few blocks, is easy to read, and can be easily adapted.
Ideas for classroom discussions
Difference between an infinite loop and a counting loop
Key question:
How do infinite loops and counting loops differ in terms of structure, functionality, and use in programs?
Discussion points:
Structure: Infinite loop without end condition vs. counting loop with a fixed number of repetitions.
Robot behavior: Infinite repetition vs. clearly limited number of runs.
Safety: When can an infinite loop become problematic (e.g., no stopping, blocked process)?
Suitability for the unit: Why is a counting loop better suited for driving a square?
Algorithmic thinking: Recognizing repetitive patterns and consciously structuring them.
Objective:
Learners should understand the functional difference between an infinite loop and a counting loop and be able to decide which type of loop is appropriate for a specific programming context.
Expected outcome:
Learners can explain that the infinite loop runs indefinitely, while the counting loop has a fixed number of repetitions.
They recognize that a square consists of four identical sequences, and therefore the counting loop is the correct and efficient choice.
They can name possible disadvantages of an infinite loop (e.g., a robot continues to move permanently).
Examples from everyday life in which counting loops play a role
Stimulus question:
In which situations in everyday life do processes repeat a fixed number of times—similar to a counting loop?
Discussion points:
Examples from technical systems: Washing machine cycles, elevator control (door opens/closes multiple times), and car turn signals (e.g., triple flash).
Examples from everyday activities: Baking or cooking (e.g., kneading dough 20 times) and sports exercises (e.g., 10 repetitions).
Objective:
The transfer to programming consists of recognizing repetitive processes, structuring them, and then implementing them using a loop; in computer science classes, this helps students to consciously perceive and understand algorithmic patterns in real-life activities.
Model solutions
Unit 1
No program code is required for this unit. You must simply prepare the eXperiBot for operation, which means:
Assemble the eXperiBot completely
Establish a connection to the app
Unit 2
Here is the solution to part 1 of Unit 2 (step 1 and step 2). The eXperiBot should drive a square without using a counting loop. Some learners may already be using a counting loop at this point.
Solution file to download and import into the eXperiBot Blockly app.
Here is the solution to part 2 of Unit 2 (steps 3 to 5). The eXperiBot should drive a square using a counting loop.
Solution file to download and import into the eXperiBot Blockly app.
The solutions to the bonus units are listed below.
Bonus unit 1
Create a program that allows your eXperiBot to drive a triangle with three sides of equal length. At the end, your eXperiBot should be back in the same place and facing the same direction as at the beginning.
Solution file to download and import into the eXperiBot Blockly app.
Bonus unit 2
Create a program that makes your eXperiBot drive in a circle.
Solution file to download and import into the eXperiBot Blockly app.
Bonus unit 3
Create a program that makes your eXperiBot drive alternately in a square and a circle—over and over again.
Solution file to download and import into the eXperiBot Blockly app.
Lesson contents
Unit 1
Connect your eXperiBot to the app.
Proceed as follows:
Switch on your eXperiBot.
Then press the “Connect” button at the top right of the screen. Follow the instructions to connect your eXperiBot to the app.



You’ve assembled your eXperiBot and connected it to the app—now you’re ready to go!
Unit 2
What does your eXperiBot need to do to drive a square? Think about it.

How often does your eXperiBot need to move forward?
How often does your eXperiBot need to turn right? How many degrees does your eXperiBot need to turn each time?
Select the appropriate blocks from the “Motor” category.
Your eXperiBot should travel the same distance four times.
You cannot enter a length in the “Motor drive forward” block.
But you can have your eXperiBot travel the same distance four times—with the same time and speed.
This creates a square with sides of approximately equal length.
Test your program.

Does your eXperiBot move in a square? If not, check the values for time and speed in your program. Adjust the values until your eXperiBot can drive a square.
Make sure that all four distances are the same length. Use the same time and speed for this.
Your eXperiBot moves in a square pattern.
Your program works, but it repeats the statements “Motor drive forward” and “Motor turn right" four times each. There is a better solution for this: the counting loop. With a counting loop, you tell the program: “Repeat these statements four times.” This makes the code shorter and clearer.
Improve your program by adding the appropriate block from the “Loops” category.
What is a counting loop?
A counting loop repeats the statements as many times as you specify. It then stops automatically.
A counting loop counts along with you—you precisely define how many times the statements should execute.
When do you need a counting loop?
Use it when you want your robot to perform an action a specific number of times, such as driving a distance four times to form a square.
How do you insert a counting loop?
Drag the "repeat … times“block from the”Loops" category. Place all the statements you want to repeat inside the loop, then enter the number of repetitions.
In the “repeat-times” block, change how often the statements should be repeated.
The "repeat" block contains a number. You can replace the number 2 with another number.
Then your eXperiBot will repeat the Statement as many times as the number indicates.
Test your program.

You can make your code shorter and clearer with loops.
Bonus unit 1
What does your eXperiBot need to do to drive an equilateral triangle? Think about it:
What movements are necessary?
How often do they need to be repeated?
Which blocks from the “Motor” and “Loops” categories will help you do this?
A triangle with three sides of equal length is called an equilateral triangle. In an equilateral triangle, all interior angles are also equal. Each angle measures 60°, because the three interior angles in a triangle always add up to 180°.

How often should your eXperiBot move forward?
How often should your eXperiBot turn right? By how many degrees should it turn each time?
Create your program. Make sure it uses as few blocks as possible and stays clear and organized.
Test your program: Does your eXperiBot drive in an equilateral triangle?

If not, change your program.
To make your eXperiBot drive an equilateral triangle, it must cover three distances of equal length.
You cannot enter a length in the “Motor drive forward” block. But you can program your eXperiBot to drive the same distance three times—using the same time and speed.
This way, your eXperiBot will drive a triangle with sides of approximately equal length.
Your eXperiBot travels in a triangle with three sides of equal length.
Check your program again. Have you used the same statements multiple times? If so, shorten your code.
Use a counting loop.
Your code is now shorter.
Bonus unit 2
Write a program that is as short as possible.
Your eXperiBot should drive exactly five circles.
After each circle, your eXperiBot should wait one second and play a short sound. This way, you can hear when it starts a new circle.
Think about how your eXperiBot can drive in a circle.
The circle doesn’t have to be perfect. However, it should be recognizable as a circle.
Knowledge about circles
Every point on the circumference of a circle is equidistant from the center point M. This distance is called the radius r.
When your eXperiBot travels in a circle, it travels a full curve. This means that your eXperiBot makes a 360° turn.
There is no block called “Drive in a circle” in the “Motor” category.
But your eXperiBot can still drive in a circle: it drives a curve at the right angle to form a circle.
In order for your eXperiBot to drive around a curve, the following happens:
The wheel on the outside of the curve turns faster because it has to travel a longer distance.
The wheel on the inside of the curve turns slower because the distance is shorter.
This is how your eXperiBot drives in a circle.

Test your program and watch closely what happens:
Does your eXperiBot drive exactly five circles?
After each circle, does your eXperiBot wait one second and play a short sound?
Does your eXperiBot then start a new circle?

If your program does not work, adjust it and test it again.
Adjust the values in the following block so that the circles are clearly visible. A circle does not have to be perfect—the important thing is that the movement looks like a circle.
Your eXperiBot drives five circles, waits after each circle, and plays a sound.
Change your program and try out new ideas.
Vary the number of circles.
Ride different circles: large and small.
Ride the circles quickly or slowly.
Invent your own melody between the circles.
Test your program.

You adjusted your program and tried out new ideas.
Bonus unit 3
What does your eXperiBot need to do to drive alternately a square and a circle? Think about it:
What movements are necessary?
How often does your eXperiBot need to repeat the change between square and circle?
Which blocks from the “Motor” and “Loops” categories will help you do this?
Create your program, using as few blocks as possible while keeping it clear.
You can use more than one Loop in a program. Sometimes one Loop is not enough because different parts of the program need to be repeated different numbers of times.
For example:
A counting loop repeats something as many times as you specify.
An Infinite Loop repeats the entire sequence over and over again—without end.
Test your program.

Does your eXperiBot alternate between driving a square and driving a circle—without stopping?
If not, adjust your program.
Your eXperiBot has already driven a square and a circle. Take another look at your two programs. Now combine the two programs. Then think about how you can repeat the sequence over and over again.
Your eXperiBot now alternates between driving in a square and a circle—over and over again!
