1 / 35

# Logo Lesson 1 - PowerPoint PPT Presentation

Logo Lesson 1. TBE 540-40 Fall 2004 Farah Fisher. What is Logo?. A programming language (instructions to the computer to perform a task) Created at MIT during a study of artificial intelligence (see http://el.media.mit.edu/logo-foundation/logo/index.html )

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.

## PowerPoint Slideshow about 'Logo Lesson 1' - ostinmannual

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

### Logo Lesson 1

TBE 540-40

Fall 2004

Farah Fisher

• A programming language (instructions to the computer to perform a task)

• Created at MIT during a study of artificial intelligence (see http://el.media.mit.edu/logo-foundation/logo/index.html)

• Can be used by virtually any student - from young children through engineering students

• Can be used to create pictures, display text, or perform calculations. Some versions can even make music!

• When Logo is used to create pictures, commands are given to a “robot turtle”.

• Some samples of the “turtle” shape:

• The simplest form of Logo uses movement commands to control the “robot turtle”.

• Sample commands:

• FD (or FORWARD) moves the turtle forward

• BK (or BACK) moves the turtle backwards

• RT (or RIGHT) turns the turtle to the right

• LT (or LEFT) turns the turtle to the left

• FD and BK both require a number, which indicates the “turtle steps” to move (steps are very small).

• RT and LT both require the number of degrees in the turn.

• Examples (notice the space after the command):

• FD 50 (move forward 50 turtle steps)

• LT 90 (turn left 90 degrees)

• As the turtle moves, it leaves a “trail” on the screen.

• These “trails” make shapes.

• Imagine for a moment that you are walking around the bases of a baseball diamond, about 30 steps on each side. Assume that you are walking forward from base to base. Are you turning left or right?

• Go to the next slide when you finish.

• In walking around the baseball diamond in your imagination, you probably followed these steps (written as they would be in Logo):

• FD 30 (home to 1st base)

• LT 90 (turn toward 2nd base)

• FD 30 (1st base to 2nd base)

• LT 90 (turn toward 3rd base)

• FD 30 (2nd base to 3rd base)

• LT 90 (turn toward home)

• FD 30 (3rd base to home)

• Imagine that you were dragging a paint brush when you walked. What shape would you have drawn?

• The commands below would make a square! (turtle shown at the end)

FD 30

LT 90

FD 30

LT 90

FD 30

LT 90

FD 30

FD 30

RT 90

FD 60

SHAPE 3

FD 50

LT 60

FD 50

SHAPE 2

RT 90

FD 50

LT 90

FD 50

SHAPE 4

FD 100

RT 45

FD 50

What shapes would these make?

FD 30

RT 90

FD 60

SHAPE 3

FD 50

LT 60

FD 50

SHAPE 2

RT 90

FD 50

LT 90

FD 50

SHAPE 4

FD 100

RT 45

FD 50

What shapes would these make?

• When you “walked around the bases”, you may have noticed that the Logo commands were repeated.

• The REPEAT command is used as a shortcut in place of writing out repeated commands.

• Example: REPEAT 2 [FD 50 RT 90] is the equivalent of FD 50 RT 90FD 50 RT 90

• Notice that the number of repeats comes first, with the commands to be repeated inside square brackets.

FD 30

LT 90

FD 30

LT 90

FD 30

LT 90

FD 30

OR…to make a SQUARE

REPEAT 4 [FD 30 LT 90]

This version actually adds another LT 90 to the list, but does not change the basic shape.

REPEAT Example

• You have seen that REPEAT 4 [FD 30 LT 90] makes a square. Guess the shapes made by the REPEAT commands below. Click to see if you were right.

REPEAT 3 [FD 30 LT 120]

REPEAT 6 [FD 30 LT 60]

REPEAT 8 [FD 30 LT 45]

REPEAT 5 [FD 30 LT 72]

REPEAT 8 [FD 30 LT 45]

REPEAT 6 [FD 30 LT 60]

REPEAT 5 [FD 30 LT 72]

• The number after REPEAT is the number of sides.

• Examine the number of repeats and the number of degrees. Try multiplying them together. Example: 4 (sides) x 90 (turn)

• The sides x degrees should always be the same number in the samples you tried.

• Could you use this information to make a 10-sided figure? Click for a possible answer.

• REPEAT 10 [FD 30 LT 36] should make a 10-sided figure.

• Why? Look at the “total turtle turns” below:

REPEAT 3 [FD 30 LT 120] 3 x 120 = 360

REPEAT 6 [FD 30 LT 60] 6 x 60 = 360

REPEAT 8 [FD 30 LT 45] 8 x 45 = 360

REPEAT 5 [FD 30 LT 72] 5 x 72 = 360

REPEAT 10 [FD 30 LT 36] 10 x 36 = 360

• When the turtle makes a closed figure (no breaks in the sides), the total turns add up to 360 degrees.

• You have just seen an example of the use of Logo to enhance critical thinking.

• Your students (and you, too) can be challenged to write the sequential steps needed to make shapes, look for patterns, predict outcomes…all part of critical thinking.

• Watch for more examples of critical thinking as you learn Logo.

• Here is another prediction task for you.

• You have seen that to make a square, you can use REPEAT 4 [FD 30 LT 90]

• Do you think the same commands would work if you turned RT instead of LT?

• How could you make a square larger? What would you have to change?

• After you have made predictions, go to the next slide.

REPEAT 4 [FD 30 RT 90]

REPEAT 4 [FD 10 LT 90]

REPEAT 4 [FD 50 LT 90]

Were you correct?

• When the Logo turtle moves, it usually draws with a “pen”.

• This pen can be “down” (draws a line) or “up” (does not draw a line). If the pen is up, the turtle moves without drawing.

• The pen can also become an eraser (remove a line already drawn).

• The pen color abd background can be changed.

• PU (PENUP) - subsequent movements of the turtle will not leave a line

• PD (PENDOWN) - subsequent movements of the turtle will leave a line

• PE (PENERASE) - subsequent movements of the turtle will erase any line it crosses

• PPT or PP (PENPAINT) - used by some versions of Logo to “undo” PENERASE

• How could you use PU and PD to make a dashed line (like the middle of a road)?

• Try making the pattern below (turtle always starts pointed “up” with the pen down):

Two possible solutions for this shape:

RT 90 FD 25 PU FD 25 PD FD 25 PU FD 25 PD

FD 25 PU FD 25 PD FD 25

Alternate using REPEAT:

RT 90 REPEAT 4 [FD 25 PU FD 25 PD]

OR…You could draw a line and go back over it with an eraser!

(NOTE: Logo commands can be placed on the same line.)

• The Logo command to set the pen color is SETPC on most versions of Logo.

• The Logo commands to set the background color is SETBG on most versions of Logo.

• Each of these commands must be followed by a number (typically from 0 to 15).

• The numbers may signify different colors in various version of Logo. You will need to experiment.

• NOTE: Some versions of Logo use a menu to choose colors.

• Here are some sample commands using color.

• SETPC 0 (pen will draw in black)

• SETPC 7 (pen will draw in white - probably)

• SETBG 3 (screen background will change color)

• NOTE: If you set the pen color and the background to the same number, you will not see any drawing!

• Suppose you enter these commands (with the turtle starting at “home” in the middle of the screen, pointing up): FD 30 RT 90

• Which shape would appear?

• Suppose you enter these commands (with the turtle starting at “home” in the middle of the screen, pointing up): FD 30 RT 90

• Which shape would appear?

• Which of the following is a Logo shortcut for

FD 50 LT 60 FD 50 LT 60 FD 50 LT 60

• REPEAT 3 (FD 50 LT 60)

• REPEAT [LT 60 FD 50]

• REPEAT 3 [FD 50 LT 60]

• REPEAT [FD 50 LT 60]

• Which of the following is a Logo shortcut for

FD 50 LT 60 FD 50 LT 60 FD 50 LT 60

• REPEAT 3 (FD 50 LT 60)

• REPEAT [LT 60 FD 50]

• REPEAT 3 [FD 50 LT 60]

• REPEAT [FD 50 LT 60]

• Which of the following sets of Logo commands will move the turtle 50 steps without drawing?

• FD 50 PU

• PU FD 50

• PE FD 50

• Which of the following sets of Logo commands will move the turtle 50 steps without drawing?

• FD 50 PU

• PU FD 50 {PENUP starts no drawing} OR

• PE FD 50 {PENERASE also starts no drawing}

• Suppose you type these three Logo commands:

• SETBG 0 SETPC 0 FD 100

• What will you see on the screen?

• Suppose you type these three Logo commands:

• SETBG 0 SETPC 0 FD 100

• What will you see on the screen?

You will see the turtle in a different place, but no line. You have instructed the turtle to draw in black on a black background!

• Use the class CD-ROM to start Logo or download it from the website at http://www.csudh.edu/fisher/tbe540

• You should see two windows - one for commands and one to show the drawing.

FD 50

RT 90

FD 25

• Try the activities from Hands-On Exercise 1. This is not a graded exercise.

• Experiment with the Logo commands listed on the handout for Week 1.