Year 3 - Lesson 1
(Shaky Sequence)
Learning Intention
- I can program a robot to carry out a sequence of movements
Introduction
We are going to be using a robot called Ohbot. Ohbot can sense the world using input devices including a keyboard, mouse, microphone or camera connected to a computer. It can ‘think’ using a program running on the computer. It can act using motors and a speaker connected to a computer. Ask children to identify how many ways Ohbot can move. Gather children’s ideas about what they think about useful jobs a robot head might be able to do. We are going to start by creating a program to make Ohbot carry out a sequence of movements.
We are going to be using a robot called Ohbot. Ohbot can sense the world using input devices including a keyboard, mouse, microphone or camera connected to a computer. It can ‘think’ using a program running on the computer. It can act using motors and a speaker connected to a computer. Ask children to identify how many ways Ohbot can move. Gather children’s ideas about what they think about useful jobs a robot head might be able to do. We are going to start by creating a program to make Ohbot carry out a sequence of movements.
Teacher Input 1
Display a set HeadTurn to 5 instruction on the screen. Explain that when the program runs this instruction it will set the motor to a position that corresponds with the number in the second box, in this case 5. With all Ohbot motors, 10 is the furthest in one direction and 0 is the furthest in the other direction, 5 will always bring Ohbot back to the middle position. Ask children to act out Set HeadTurn to 10, Set HeadTurn to 0 and Set HeadTurn to 5. Teacher to say the commands, children to be human robots. Ask children to suggest what they think would happen if they entered a value greater than 10 or less and 0 into the box. How about a decimal value?
We will need to open the Ohbot application on our computer. Children use a when green flag clicked instruction and a set Headturn to instruction to explore how changing the value of the number alters the position of Ohbot’s head when the green flag is clicked.
Display a set HeadTurn to 5 instruction on the screen. Explain that when the program runs this instruction it will set the motor to a position that corresponds with the number in the second box, in this case 5. With all Ohbot motors, 10 is the furthest in one direction and 0 is the furthest in the other direction, 5 will always bring Ohbot back to the middle position. Ask children to act out Set HeadTurn to 10, Set HeadTurn to 0 and Set HeadTurn to 5. Teacher to say the commands, children to be human robots. Ask children to suggest what they think would happen if they entered a value greater than 10 or less and 0 into the box. How about a decimal value?
We will need to open the Ohbot application on our computer. Children use a when green flag clicked instruction and a set Headturn to instruction to explore how changing the value of the number alters the position of Ohbot’s head when the green flag is clicked.
Next, we will work together to write the code to make Ohbot carry out a sequence of movements to make it shake its head. First, we need a when green flag clicked instruction from the Events palette to make the sequence start. Then we will need a sequence of set HeadTurn to instructions from the Motion palette. Encourage children to think about why a sequence of set HeadTurn to instructions results in Ohbot’s motors moving to the last position in the sequence without going through the preceding ones. Highlight that computers carry out instructions almost unimaginably quickly, the three blocks will run in around 0.000000003 of a second. Even if Ohbot’s motors could move this fast –which they can’t- your eye probably wouldn’t be able to perceive the movement. One way of slowing down the movement is to add an instruction that makes the program wait between each of the instructions.
Wait can be found on the Control palette and will give Ohbot’s motors time to move to each position before the next position overrides it. Once the code is complete we need to click the green flag to test it. We may need to debug the code if it is not working correctly. Encourage children to review what Ohbot is doing compared to what they wanted it to do, identifying the instruction or instructions that are causing this and identifying a possible solution to try before running again. Once the code is fully working we need to save our work using by selecting Save As from the File menu. Save as ‘head shake’ to complete the task. We can now use this first simple program we have written as a skeleton to make other parts of Ohbot move. Children to now work through the activties on the slides.
Activities
1. Write a program to make Ohbot nod its head up and down.
2. Write a program to make Ohbot’s eyes look from left to right.
3. Write a program to make Ohbot’s eyes look up and down.
Extension
Experiment to write a sequence to make other parts of Ohbot move?
Plenary
Look at examples of the children’s coding. Were they successful? Did they need to debug their code? How many tasks did they complete? How did you find today’s lesson? (Thumbs up, down, middle).
1. Write a program to make Ohbot nod its head up and down.
2. Write a program to make Ohbot’s eyes look from left to right.
3. Write a program to make Ohbot’s eyes look up and down.
Extension
Experiment to write a sequence to make other parts of Ohbot move?
Plenary
Look at examples of the children’s coding. Were they successful? Did they need to debug their code? How many tasks did they complete? How did you find today’s lesson? (Thumbs up, down, middle).