Adding colour
Programming with Logo - Lesson 3
Objectives
- To give simple commands using Logo
- To decompose a bigger problem into smaller parts
- To know and use Logo pen up/down and colour commands
Lesson Resources
Lesson 1 - Introducing Logo
Lesson 2 - Drawing Words
Lesson 3 - Adding Colour
Lesson 4 - Repeat Commands
Lesson 5 - Procedures
Lesson 6 - Progressing To Scratch
Introduction
Recap the skills and commands that they have learnt so far. How did we achieve curves in the last lesson? How did they decompose the problem of writing a word with the robot last week? What rules do we need to follow when using Logo?
New Pen Commands
Introduce some new commands to the children that relate to the way the pen works:
Ask them to investigate these commands on their own first before you reveal what they do.
- pu
- pd
- setpc 1
- setpw 20
Some children will think nothing is happening when they enter the commands as you do not see the result of them until you tell the turtle to move again, for example you cannot see that the pen is raised until it moves and no line is left. Give them time to try and find the solution themselves.
Then demonstrate and establish what each command does:
- pu = pen up (won’t leave a pen trail)
- pd = pen down (leaves a pen trail)
- setpc 1 = changes the pen colour to blue (other colours are available)
- setpw 20 = changes the width of the pen to '20'
You can share the lesson objectives at this point.
Tell them that we have more than just blue and that different numbers represent different colours. Ask them to investigate what colours are available using the number range 0 to 15.
setpc n = changes the pen colour to be the colour value n (replace n with 0-15)
- 0 = black
- 1 = blue
- 2 = green
- 3 = cyan
- 4 = red
- 5 = pink
- 6 = yellow
- 7 = white
- 8 = brown
- 9 = biege
- 10 = dark green
- 11 = light blue
- 12 = light pink
- 13 = purple
- 14 = orange
- 15 = grey
They can then move the robot, draw shapes and multicoloured patterns using the new commands that they know.
Can they code a multicoloured zigzag? or a red and blue square?
Next ask them to consider how we could draw a rainbow with the robot. How could we decompose that problem?
- What colours do we need?
- Where should we start?
- What sizes should we use for each part?
Show them this example:
Some children might be able to move between each line by lifting the pen (pu) and programming the movement to the start position of the next line. Some children might just need to move it with the mouse.
Plenary
Review their work at the end. What was difficult? Which bits were easier? Why?
Who managed to add more than one instruction at a time? Did anyone manage to input the algorithm for a full curve in one go? How did you debug any mistakes?
Here’s one other new colour command, what do you think it will do?
- setbg n = set the background of the screen to colour value n. (0-15 - same colour codes as the pen above)