Are you a teacher?
Lesson Plan
Courses
- Grades 6-12
- 6th Grade – 12th Grade Courses
Materials
- Cell phone, tablet, or computer
- Internet connection
Description
In this activity, students can experiment with Protobject, learning visual programming and computer science in a safe and playful way.
Educational Objectives
- Understand the concept of While (repeat while) in programming
- Create a technological object (prototype) using a device
- Identify relationships between technology and the surrounding world
- Evaluate personal and peer work in individual or team tasks
- Discuss and reflect on ideas for improvement
Start (10 minutes)
Welcome the students to the class and briefly introduce the day’s activity, “today we will learn to prototype a game with a balloon.”
We will start the class by providing technical knowledge to the students for meaningful learning of the practical activity.
To open the class, we can begin with a question:
Have you heard of “repeat while” in programming?
You can let the students propose their answers and then provide the correct response.
A “repeat while” loop, also known as “while” in English, repeats a block of code as long as a condition is true. The instructions within the block will be executed repeatedly until the condition is no longer true, meaning it becomes false. When this happens, the rest of the code continues to execute.
Let’s see an applied example. A regular polygon is defined as a polygon where all its sides and angles are equal. So, to draw one, you would have to draw all its sides the same size, making sure that the interior angles are also equal to each other.
So, how do we draw a three-sided one? You would have to draw three lines, forming an equilateral triangle. The same goes for a four-sided one, which would be a square. What if we wanted to make a ten-sided one? Or fifty sides? The work becomes quite tedious!
So, how do we draw it?
A property of polygons is that the sum of all their exterior angles is always 360°, regardless of how many sides they have. Since in a regular polygon all angles must be equal, we can say that one angle is equal to 360 divided by the number of sides.
So, let’s try drawing an equilateral triangle with a perimeter of 30: We draw a line of size 10, which is the perimeter divided by the number of sides. We rotate to the left by 120°, which is 360 divided by the number of sides. We draw another line of size 10. We rotate again by 120°. We draw the last line of size 10.
And we have a triangle!
Now, let’s use the “repeat while” block. If you notice, in the previous procedure, we have only two steps that are constantly repeated: drawing a line and rotating a certain number of degrees to the left.
But how many times do we have to do this?
Until we have drawn all the sides of the regular polygon!
So we can say that while we haven’t drawn all the sides, we must draw a segment and rotate a certain number of degrees to the left. These steps repeat until the condition is met! Having gone through all this reasoning, we are finally ready to program.
Let’s use the “Repeat While” block!
Finally, to start the prototyping process and make them feel like protagonists of their learning, ask them:
Shall we create a game to make it clearer?
Let’s think of a game where a balloon inflates more and more WHILE you keep pressing the touch button, and when it reaches a certain limit, it turns red and bursts!
Development (20-30 minutes)
Connect your equipment to the Protobject platform. For this exercise, we will use the TOUCH BUTTON, DRAW/ERASE, and SOUND PLAYER
Remember to experiment yourself beforehand to anticipate questions that may arise from the students.
You can follow the step-by-step code for the activity, and if you have any doubts, read the commented code.
To test the prototype, instruct the students to click on the activation button.
Congratulations!
Conclusion (5-10 minutes)
- How can we change the perimeter of the figure?
- What happens if we rotate to the right instead of the left?
- How could we change the color of the lines along with the number of sides of the polygon?
Try modifying values to understand how it works!