Sequence 2 - Lesson 4: Repeat Until
Learning Intention
I can program a robot to speak the value of a variable
I can program a robot to count until a condition is true
I can program a robot to speak the value of a variable
I can program a robot to count until a condition is true
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 Picoh start counting from a set number.) Today, we are going to continue with our work on the variable ‘Count’ to make Picot continue counting until it reaches a certain number. We will start by getting Picot 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 Picoh start counting from a set number.) Today, we are going to continue with our work on the variable ‘Count’ to make Picot continue counting until it reaches a certain number. We will start by getting Picot to say the number it is counting.
Activity
Ask children to create a program that counts up on in 2s. Can they work out how to make Picoh 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 Picoh 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 Picoh 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 Picoh speaks in all the counting tasks.
Activity 2
Can you make Picoh stop counting when it reaches 100? There are a number of ways of doing this. Children may suggest using repeat. To make Picoh 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?
Can you make Picoh stop counting when it reaches 100? There are a number of ways of doing this. Children may suggest using repeat. To make Picoh 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?
Activities 3-5
3: Can you make Picoh count back in tens? Picoh must start at 200 and stop when it gets to 100.
4: Can you make Picoh count back in fives? Picoh must start at 250 and stop when it gets to 200.
5: Can you make Picoh count back in twos? Picoh must start at 100 and stop when it gets to 20.
3: Can you make Picoh count back in tens? Picoh must start at 200 and stop when it gets to 100.
4: Can you make Picoh count back in fives? Picoh must start at 250 and stop when it gets to 200.
5: Can you make Picoh count back in twos? Picoh must start at 100 and stop when it gets to 20.
Extension
Can you make Picoh open and close its mouth while it is counting so it appears to talk?
Can you make Picoh open and close its mouth while it is counting so it appears to talk?
Plenary
Encourage children to share their scripts for making Picoh move its lips as it speaks. Which are the most effective?
Encourage children to share their scripts for making Picoh move its lips as it speaks. Which are the most effective?