Year 4 - Lesson 4
(Repeat Until)
Learning Intention
- I can use a variable to make a robot speak a count
- I can use a conditional to make a robot count up to a certain value
Introduction
What did we learn to do last week? (make a variable called ‘Count’ to keep a count in ones, twos, fives and tens and make Ohbot start counting from a set number.) Today, we are going to continue with our work on the variable ‘Count’ to make Ohbot continue counting until it reaches a certain number. We will start by getting Ohbot to say the number it is counting.
What did we learn to do last week? (make a variable called ‘Count’ to keep a count in ones, twos, fives and tens and make Ohbot start counting from a set number.) Today, we are going to continue with our work on the variable ‘Count’ to make Ohbot continue counting until it reaches a certain number. We will start by getting Ohbot to say the number it is counting.
Activity 1
Ask children to create a program that counts up on in 2s.
Can they work out how to make Ohbot speak the value of the count variable. This can be achieved by dragging the variable ‘Count’ into the say instruction.) Once successful the children can open up the code they wrote last week and add the say instruction so that Ohbot speaks in all the counting tasks.
Ask children to create a program that counts up on in 2s.
Can they work out how to make Ohbot speak the value of the count variable. This can be achieved by dragging the variable ‘Count’ into the say instruction.) Once successful the children can open up the code they wrote last week and add the say instruction so that Ohbot speaks in all the counting tasks.
Activity 2
Can you make Ohbot stop counting when it reaches 100? There are a number of ways of doing this. Children may suggest using repeat. To make Ohbot stop counting when it gets to 100 which part of the code do you think we have to change? (We need to go to the Control palette and change the forever instruction to a repeat until instruction.) We will need an operator to fit inside the empty hexagon. Have a look on the Operator palette to see which operator you think we need. What do you think needs to go in the operator’s two spaces? Also remember to have the tick next to ‘Count on the Data palette to watch the counting. Save the project as, ‘count up to 100’. We can now use this knowledge to complete other counting tasks? Children to now work through tasks on slides
Can you make Ohbot stop counting when it reaches 100? There are a number of ways of doing this. Children may suggest using repeat. To make Ohbot stop counting when it gets to 100 which part of the code do you think we have to change? (We need to go to the Control palette and change the forever instruction to a repeat until instruction.) We will need an operator to fit inside the empty hexagon. Have a look on the Operator palette to see which operator you think we need. What do you think needs to go in the operator’s two spaces? Also remember to have the tick next to ‘Count on the Data palette to watch the counting. Save the project as, ‘count up to 100’. We can now use this knowledge to complete other counting tasks? Children to now work through tasks on slides
Activities
3: Can you make Ohbot count back in tens? Ohbot must start at 200 and stop when it gets to 100.
4: Can you make Ohbot count back in fives? Ohbot must start at 250 and stop when it gets to 200.
5: Can you make Ohbot count back in twos? Ohbot must start at 100 and stop when it gets to 20.
3: Can you make Ohbot count back in tens? Ohbot must start at 200 and stop when it gets to 100.
4: Can you make Ohbot count back in fives? Ohbot must start at 250 and stop when it gets to 200.
5: Can you make Ohbot count back in twos? Ohbot must start at 100 and stop when it gets to 20.
Extension
Can you make Ohbot open and close its mouth while it is counting so it appears to talk?
Plenary
Encourage children to share their scripts for making Ohbot move its lips as it speaks. Which are the most effective?
Can you make Ohbot open and close its mouth while it is counting so it appears to talk?
Plenary
Encourage children to share their scripts for making Ohbot move its lips as it speaks. Which are the most effective?