a1tD0000007keppIAA

Course: Introduction to Programming with Ozobot
5) Functions

  • 6-12 grade
  • Intermediate

Lesson Description:

Students learn about function blocks and then apply it to their code to…

  1. Create a program that off-sets the robot’s drift from a straight line.
  2. Create a function for Ozobot to move in a straight line.
  3. Create a dance routine for Ozobot using multiple functions.

image description

Lesson Modules


Teaching Tips:

This lesson will take about 2 hours to complete. You may have to split the lesson into multiple classes.


Materials:


• One Ozobot per student/group (suggestion: 2-3 students per group)
• One computer for each student/group
• Teacher computer
• Internet connection
• Projector
• One pack of thin markers or colored pencils per student/group


Preparation:


• Make sure Ozobots are charged before beginning the lesson
• Print ONE copy of the test track PER student/group AND ONE copy for the teacher.
• Print ONE copy of the Cha-Cha Slide Dance Steps PER student/group

Observation activity:
1) Show the program on the class view
2) Have students set up the same program on their computers
3) Students run the program three times and outline Ozobot where it stops

In this section we will track Ozobot's drift from a straight line.


Teaching Tips:

1) Show the students’ goals on the class view.

2) Show the next section of the class view which lets the students know they are going to be on level 4 in Ozoblockly for today's lesson. 

3) Build and Track Results Acvitiy

a) Open Ozoblockly
b) Choose level 4
c) Build the following program


d) Just like the students did in the observation activity - run Ozobot and track where it ends.

e) Change one of the numbers (left OR right)
f) Load the program onto the Ozobot
g) Run Ozobot on the test track
h) Trace where Ozobot stopped and write the left and right wheel speeds on the test track
i) Ask the students: Through this experiment what did we discover?
j) Then ask students what we should change next.
k) Continue doing this one or two more times.

4) Show the next section on the class view which has their 1st goal (Create a program that off-sets the robot’s drift from a straight line) and instructs them to track their experiments until their Ozobot goes straight. If a group has an Ozobot that travels in a straight line – have them work with another group.

5) Give students time to change their code, test, record, and repeat until Ozobot moves in a straight line.

6) Show the next section on the class view and let students know that the next few activities will help them understand how to use functions.

7) Play the next video on the class view. Have students follow the directions of the song and dance the Cha-Cha Slide.

8) Show the next section of the class view to the students (Cha-Cha slide dance steps) and discuss “Do you think a programmer wants to create a program for a robot to follow all of the following 70 dance steps?”

9) Show the next section of the class view. Give each student/group a copy of the Cha-Cha Slide Dance Steps . Do the 1st part together.
Example on how to start:

10) Open Ozoblockly and build the following program.

A) keep your code from the 1st goal

B) In the left hand toolbox click functions

c) Click and drag the 1st function block “to do something” to the workspace

d) Change the name “do something” to “Move in a straight line”

e) Move your code into the “Move in a straight line” block

f) In the left hand toolbox click functions

g) You will not see a small function block titled “Move in a straight line”, click and drag the block onto the work space

h) Move blocks to match the following program
i) Run the program


11) Show the students the question on the class view and facilitate a class discussion. What do you think the benefit is of using functions?
Possible Answers: Makes your code shorter and more organized, it can make your code easier to understand

12) Show the next section on the class view, have students create a function for Ozobot moving in a straight line.

13) Show the next section on the class view, discuss ...
How many steps are there in the Cha-Cha Slide? (Answer: 70)
How many functions would a programmer make for this dance?
Ex: cha-cha, step left, …



In this section we will focus on the purpose of using functions in our programs.


Teaching Tips:

Show the students’  goal on the class view: Create a dance routine for Ozobot using multiple functions.


During the design time, walk around and prompt your students with questions to help deepen their learning and thinking process. Some examples of questions are:

Why did you make that design decision?
What do you predict your code will do?

In this section we will program a dance for Ozobot using functions.


Teaching Tips:

Have students answer the following questions on their computers. Once all the students have finished answering the questions have a class discussion about their answers. 

For question 3 you can click the “Show Results” button on the class view under the question and the students’ responses will show up as a word cloud (the more common the word the larger it will show up)

1) Explain function blocks.
2) What are the benefits of using function blocks?
3) What was your favorite part of Ozobot’s dance? (Answer in ONE word)


Have students plug their Ozobots into their chargers.

In this section we will reflect on our learning. 


Explain function blocks.

What are the benefits of using function blocks?



What was your favorite part of Ozobot’s dance? (Answer in ONE word)



Plug your Ozobot in so it will be ready for you to use next time.