Sequence 4 - Lesson 4: Picoh Pet
Learning Intention
- I can incorporate variables into my program to make a robot behave like a robot pet.
Introduction
What did we do last week. (Make a Variable called “sleepy.”) This week we are going to build on the skills we learnt last week, using variables. Discuss robot pets that children might have come across and similarities to a real pet such as requiring ‘feeding’ and attention.
We will create a robot pet with two needs; warmth and food. For each we will have a separate variable. One need will be to have been fed, we will call this one ‘full tummy’ and the other will be to be warm, we will call this ‘warm’. Picoh will respond to the variables in different ways depending on how hungry it is and how cold it is feeling. Full tummy will go from 10 which is full to 0 which is empty and Warm will go from 10 which is warm to 0 which is cold. Ask children to come up with the combinations that are possible and what the variable values might be for each.
For example:
Warm 10 Full Tummy 10
Warm 10 Empty Tummy 0
Cold 0 Full Tummy 10
Cold 0 Empty Tummy 0
What did we do last week. (Make a Variable called “sleepy.”) This week we are going to build on the skills we learnt last week, using variables. Discuss robot pets that children might have come across and similarities to a real pet such as requiring ‘feeding’ and attention.
We will create a robot pet with two needs; warmth and food. For each we will have a separate variable. One need will be to have been fed, we will call this one ‘full tummy’ and the other will be to be warm, we will call this ‘warm’. Picoh will respond to the variables in different ways depending on how hungry it is and how cold it is feeling. Full tummy will go from 10 which is full to 0 which is empty and Warm will go from 10 which is warm to 0 which is cold. Ask children to come up with the combinations that are possible and what the variable values might be for each.
For example:
Warm 10 Full Tummy 10
Warm 10 Empty Tummy 0
Cold 0 Full Tummy 10
Cold 0 Empty Tummy 0
Activity 1: Ask children to think about what might happen to full tummy over time. Challenge children to create a variable called ‘full tummy’ (remind them about putting a tick in the box next to the variable name to display its value) and make it decrease from 10 to zero over time. Can they find a way of providing food when the ‘f’ key is pressed?
Activity 2: We will control warmth manually, just like setting the central heating at home. Can we create a variable called ‘warm’ that increases when one key is pressed and decreases when another is pressed?
Activity 3: Return to the table from previously and challenge children to think about what Picoh might say in each of the possible scenarios:
Warm 10 Full Tummy 10 I’m lovely and warm and full
Warm 10 Empty Tummy 0 I’m lovely and warm but I’m hungry
Cold 0 Full Tummy 10 I’m cold but I’m not hungry
Cold 0 Empty Tummy 0 I’m cold and hungry
Model how to create a condition to check the values of the variables. Create a condition for one of the scenarios:
Warm 10 Full Tummy 10 I’m lovely and warm and full
Warm 10 Empty Tummy 0 I’m lovely and warm but I’m hungry
Cold 0 Full Tummy 10 I’m cold but I’m not hungry
Cold 0 Empty Tummy 0 I’m cold and hungry
Model how to create a condition to check the values of the variables. Create a condition for one of the scenarios:
Activity 4: Challenge children to create If conditions for the other scenarios.
Extension:
What happens when the values of warm or full tummy go outside the range 0 to 10? Can you find a way of limiting the value of the variables or making Picoh react in a different way if the outside the range 0 to 10?
Plenary
Take a look at the children’s own projects. Were they successful? How did you find today’s lesson? (Thumbs up, down, middle)
What happens when the values of warm or full tummy go outside the range 0 to 10? Can you find a way of limiting the value of the variables or making Picoh react in a different way if the outside the range 0 to 10?
Plenary
Take a look at the children’s own projects. Were they successful? How did you find today’s lesson? (Thumbs up, down, middle)