Sequence 1 - 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 Picoh. Picoh 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 Picoh 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 Picoh carry out a sequence of
movements.
We are going to be using a robot called Picoh. Picoh 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 Picoh 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 Picoh 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 Picoh motors, 10 is the furthest in one direction and 0 is the furthest in the other direction, 5 will always bring Picoh 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 Picoh application on our computer. Children use a when green flag clicked event block and a set HeadTurn to instruction to explore how changing the value of the number alters the position of Picoh’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 Picoh motors, 10 is the furthest in one direction and 0 is the furthest in the other direction, 5 will always bring Picoh 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 Picoh application on our computer. Children use a when green flag clicked event block and a set HeadTurn to instruction to explore how changing the value of the number alters the position of Picoh’s head when the green flag is clicked.
Next, we will work together to write the code to make Picoh 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 instructions results in Picoh’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 Picoh’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 Picoh’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 Picoh 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 by selecting Save As from the File menu. To complete the task use
File, Save As – headshake
We can now use this first simple program we have written as a skeleton to make other parts of Picoh move. Children to now work through the activities on the slides.
File, Save As – headshake
We can now use this first simple program we have written as a skeleton to make other parts of Picoh move. Children to now work through the activities on the slides.
Activities
1. Write a program to make Picoh nod its head up and down. File, Save As - headnod
1. Write a program to make Picoh nod its head up and down. File, Save As - headnod
2. Write a program to make Picoh’s pupils look from left to right.
File, Save As - eyesleft
File, Save As - eyesleft
3. Write a program to make Picoh’s pupils look up and down.
File, Save As - eyesup
File, Save As - eyesup
Extension
Experiment to write a sequence to make other parts of Picoh 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).
Experiment to write a sequence to make other parts of Picoh 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).