The ICT Lounge
 
Section 6.4:
Microprocessors in Control Applications - Turtle Graphics
 

Computers can be given sets of instructions which they will follow to control objects on the screen. Giving instructions to a computer is also known as 'programming'.

In this section we will take a look at how a computer can be programmed using a simple language called 'LOGO'.

Key Concepts of this section:
#
Understand how computers can be programmed to 'control' objects on the screen.
#
Know the most common LOGO commands.
#
Be able to use LOGO to draw different shapes by inputting commands.

Logo - (aka Turtle Graphics)
Key Words:
Turtle graphics, LOGO, Commands, Programming
What is logo?
#
LOGO (also known as 'Turtle Graphics') was developed in 1967 as a way to teach children basic computer programming.

Examples:
When logo was first released in the 1960's, commands controlled a robot that was shaped like a turtle.
Modern versions of LOGO have seen the physical robot turtle replaced with an on-screen curser turtle
#
In LOGO, a curser (called a turtle) can be controlled and moved around the screen by inputting simple commands. As the curser moves around the screen it draws a line.

#
Common LOGO commands are shown in the table below:

Command
Meaning
Example
PENDOWN
Lower the pen down (to draw a line).
PENDOWN
PENUP
Lift the pen up (to stop drawing a line).
PENUP
FORWARD n
Move the turtle forward n steps.
FORWARD 50
BACKWARD n
Move the turtle backward n steps.
BACKWARD 30
LEFT n
Turn left n degress.
LEFT 90
RIGHT n
Turn right n degress.
RIGHT 45
REPEAT n



ENDREPEAT

Commands in between these lines should be repeated n times.
REPEAT 4
FORWARD 20
RIGHT 90
ENDREPEAT

Note:
Using combinations of these commands makes it possible to draw all kinds of different shapes

Examples of some shapes you can draw using logo commands:
 
#
Here are some examples of LOGO commands being used to draw simple shapes.

You will practice drawing each shape in an online version of LOGO which can be accessed by clicking the link in the grey box found on the right of each example.

Example 1 - A solid shape:

Shape to draw:
LOGO commands to draw it:
 
PENDOWN
FORWARD 60
RIGHT 90
FORWARD 60
RIGHT 90
FORWARD 30
RIGHT 90
FORWARD 30
LEFT 90
FORWARD 30
RIGHT 90
FORWARD 30
 
Click here to open an online version of LOGO and draw the shape to the left
NOTE:
In this version of logo the forward, right and left commands are abbreviated
(Forward = FD, Right = RT, Left = LT)

 

Example 2 - A shape with gaps:

Shape to draw:
LOGO commands to draw it:
 
PENDOWN
FORWARD 40
RIGHT 90
FORWARD 20
PENUP
FORWARD 10
PENDOWN

FORWARD 20
RIGHT 90
FORWARD 40
RIGHT 90
FORWARD 20
PENUP

FORWARD 10
PENDOWN

FORWARD 20
 
Click here to open an online version of LOGO and draw the shape to the left
NOTE:
In this version of logo the forward, right and left commands are abbreviated
(Forward = FD, Right = RT, Left = LT)

 
     
Example 3 - Using REPEAT n ENDREPEAT:
 
Shape to draw:
LOGO commands to draw it:
Option 1
Option 2
PENDOWN
FORWARD 30
RIGHT 90
FORWARD 30
RIGHT 90
FORWARD 30
RIGHT 90
FORWARD 30
PENDOWN
REPEAT 4
FORWARD 30
RIGHT 90
ENDREPEAT
NOTE!
Both of the options above will draw the shape to the left. Option 2, however, does it in less steps by using the REPEAT n ENDREPEAT COMMAND
Click here to open an online version of LOGO and draw the shape to the left
NOTE:
In this version of logo the forward, right and left commands are abbreviated
(Forward = FD, Right = RT, Left = LT)

 
 
Example 4 - Your practice shape:
 
Shape to draw:
Option 1
Option 2
PENDOWN









FORWARD 30
PENDOWN
REPEAT 6



ENDREPEAT
NOTE!
There are 2 ways to create this shape and I have started and ended each option for you.

See if you can complete both methods.

Click here to open an online version of LOGO and draw the shape to the left
NOTE:
In this version of logo the forward, right and left commands are abbreviated
(Forward = FD, Right = RT, Left = LT)

 

Activity!

Click the above task and print all pages. Answer each of the past paper LOGO questions.

Answers to the questions can be found on pages 6 and 7. Check your answers and make any necessary changes.

Please add your questions/comments below:
 

Links to Theory Units:
 
Links to Practical Units:
Section 11: File Management
Section 12: Images
Section 13: layout
Section 14: Styles
Section 15: Proofing
Section 16: Graphs and Charts
Section 17: Document Production
Section 18: Data Manipulation
Section 19: Presentations
Section 20: Data Analysis
Section 21: Website Authoring