LOGO TUTORIAL
LOGO is a computer programming language that allows you to use analysis, perspective, planning, and basic mathematics to create beautiful graphics. LOGO is free! All you need is an online computer. Once the program(s) are downloaded, you can do almost all LOGO creations off line. There are presently three versions of LOGO: an older MSW LOGO, a newer FMS LOGO,and a more advanced UCB LOGO. All are good programs and have more similarities than differences. This tutorial was written specifically for the MSW and FMS versions. MSW LOGO can be downloaded HERE. And FMS LOGO HERE. My tutorial is easy to understand and easy to follow. It was designed to teach teachers LOGO so that they might teach it to their students. The tutorial is also free. Developmental psychology has shown that if certain brain circuits are not used during critical periods of our development, then these neurons may not just go unused, but may actually be physically removed from our brain. Activities, such as LOGO, stimulate and use the brain circuits involved in mathematics, logic, geometry, trigonometry, spatial imagery, and creativity. Then, when students are called upon to become skillful in these high level tasks, the brain circuits needed to master these operations are intact, functional and ready to learn. Empirically, LOGO has been shown to increase intelligence. But LOGO is not just for the young. A conclusive body of evidence shows that, as we age, we must "use it or lose it." Mental stimulation has been shown time and again to prevent or delay the onset of dementia. LOGO can be good mental stimulation for all ages. And LOGO is fun! Using logical operations, students get near instant feedback on their work in the form of graphic designs. These designs give meaning and purpose to mathematical procedures. LOGO teaches students about Geometry and Trigonometry without them even knowing it. And their graphics creations can be beautiful works of art. After loading the LOGO programs to their computer, students may begin creating graphic art by using LOGO COMMANDS. If they plan on using this as a tutorial, they may want to print out this page, especially if they will be working off line. Or they can keep the LOGO screen and this page in separate browser windows, and switch back and forth as necessary. This may be the better idea as many procedures are more easily accomplished with "cut and paste." Keeping this page in a separate browser window gives quick access to cut and paste, and to transfer to the LOGO screen. *Note: all LOGO commands are executed by hitting the "enter" key, or by clicking the "execute" button in the lower right of the LOGO screen. Almost all LOGO commands are NOT case-sensitive. MOVEMENT AND DIRECTION COMMANDS FD n moves the turtle forward n pixels. Example: fd 100 BK n moves the turtle backward n pixels. Example: bk 100 LT n rotates the turtle n degrees left. Example: lt 45 RT n rotates the turtle n degrees right. Example: rt 45 TURTLE & POSITION COMMANDS ST shows the turtle as a triangular cursor. HT hides the turtle. home returns the turtle to the start position at the center of the screen. CS clears the screen and returns the turtle to home. The screen can also be cleared and the pen brought home by clicking the "reset" button at the bottom right of the LOGO screen. repeat n [ command list] repeats the actions listed in the command list an n number of times. Example: Repeat 4[fd 100 lt 90]. *IMPORTANT NOTE: the brackets used in LOGO are next to the "P" key and do not require a shift. Example: [ ] wait n pauses for a specified amount of time, (measured in 1/60 seconds), before executing the next command. So, if n is 60, the program will pause for 1 second. Wait 360 would cause a pause of 6 seconds. You can also use a random wait command. For example, wait random 600 would produce a random waiting period which varies from zero to 10 seconds. PU Means "pen up." This command lifts the pen (turtle) from the screen so that moving the turtle doesn't draw a line. Example: PU fd 150. The turtle would move 150 pixels without leaving a line. PD Puts the pen down so that moving the turtle draws a line. Example: pu fd 150 pd fd 150 SetPenSize [n n] Sets the width of the pen to n pixels. Note that it is necessary to put in two numbers. Example: SetPenSize [5 5]. You can also select pen size by clicking "set" at the top left of the LOGO screen, then select "pen size" and make a choice. SetPC [r g b] Sets the pen color to the appropriate RGB (red, green, blue) values, where r, g, and b are numbers that range from 0 to 255. Example: SetPC [255 0 0] creates red, SetPC [0 255 0] creates green, and SetPC [0 0 255] creates blue. Other colors are created by manipulating these three numbers. A color chart can be found in a Google search. You can also choose a pen color by clicking "set" at the top left of the LOGO screen, then click "pen color," and make a color selection. Note that additional colors can be generated by sliding the three color bars. Screen color is selected by clicking "set" at the top left of the LOGO screen, then clicking "screen color" and making a selection. Note that additional colors can be generated by sliding the three color bars. SETTING THE X & Y PEN COORDINATES: To move the turtle to various places on the screen, use the pu command, followed by movement and directional commands. For example, pu fd 200 rt 90 fd 100 lt 90 pd. Another way to set the turtle to a specified screen location is to use the setpos [x y] command. For example, setpos [200 100]. This would move the pen to the right 200 pixels and forward 100 pixels. To set the pen to the left, use negative numbers such as: setpos [-200 -100]. If you don't want to leave a line as the pen repositions, be sure to use the pu command. For example, pu setpos [200 200]pd pe is the command for penerase. When the pe command is used, movement of the turtle erases whatever is under it. If nothing is under it, the pen will make whatever line is commanded. Pennormal sets the pen back to normal mode, canceling the pe erase mode. setfloodcolor [r g b] sets the flood color. This allows you to flood a space bound by lines with the color you select. 1. Set the flood color, for example: setfloodcolor [255 0 0] sets the flood color as red. 2. With the pen up (pu), move the turtle into the area to be flooded. Once placed in the area to be flooded, put the pen down (pd). 3. The command, fill, floods the area with the selected flood color. *Note: You may also select a flood color by clicking "set" at the top left of the LOGO screen, and clicking on "flood color" and making a selection. However, you must still pull the pen up (pu), move the turtle into the area to be flooded, place the pen down (pd), then enter the "fill" command to execute the flooding. Example: Step # 1. Enter into the commander: repeat 4[fd 100 rt 90] rt 45 repeat 4[fd 100 rt 90]pu rt 10 fd 20 then hit "enter." These commands create two overlapping squares and move the turtle into the area to be flooded. Step # 2. Enter into the commander: setfloodcolor [255 0 0] pd fill pu bk 20 lt 10 pd hit "enter." The small area shared by the two squares should be flooded with the color red. When you type: arc 180 80, your turtle will make the arc and return to the center (origin). However, there is a way to make the turtle stay at the end of the arc rather than to return to the origin. To do this type: arc2 180 80. This allows you to continue your graphic from the end of the arc. This allows you to make curves of various sizes. You may have noticed that the arcs created with these commands always arc upward and to the right. To make an arc go left and downward, use negative numbers, for example: arc -180 80. Try these to get the feel of direction changes: arc 180 -90, arc -180 90, arc -180 -90, arc2 180 -90, arc2 -180 90 arc2 -180 -90. The commands circle and circle2 are available to create circles of a given radius. The command: circle 50 creates a circle of radius 50 with the turtle ending at the center (origin). The command: circle2 50 creates a circle of radius 50, with the turtle ending at the edge of the circle. Random: Some interesting graphics can be made using random numbers. For example, the command: repeat 500[fd random 15 rt random 360]. This will draw a picture in which a distance of between 1--15 units forward is followed by a right turns of between 1--360 degrees. These two variables will be repeated 500 times. MATHEMATICS SQRT is the command for square root. For example sqrt 36 would yield a value of 6. / is the command for division. For example, 45/5 would yield a value of 9. + is the command for addition. For example, fd 200 + 100 would move the turtle forward 300 pixels - is the command for subtraction. For example, bk 200 - 100 would move the turtle backwards 100 pixels. * is the command for multiplication. For example, fd 100 * 5 would move the turtle forward 500 pixels. *Note: to find an answer using one of the above, type into the commander "print sqrt 100," for example. LOGO will respond like a calculator with the answer, 10. If, however, you wish to use the calculated answer in the program, omit the word "print." For example, repeat 30-3[fd 500/sqrt 160 rt 3.1417 * 4]. Creating PROGRAM COMMANDS Individual LOGO Commands can be combined and saved to make Program Commands. To make a program command, go to the edit mode by clicking the "edall" button at the lower right portion of the screen. As an example we will make a program called x. In the editor type: to x repeat 4[fd 200 rt 90] end. Then, in the upper left of the LOGO screen, click "file," then click "save and exit." The program called x has been created and saved. Whenever you enter x into the commander, a square (program x) will be drawn by the turtle. To give you more control over the square produced by x, you can add variables. To add two variables to our program x, click "edall" to get back into the editor, and make these changes: to x :size :sides repeat :sides[fd :size rt 360/:sides] end click "save and exit" to save your changes. Now enter into the commander x 200 5 and you will get a pentagon. x 200 6 produces a hexagon, etc. *Note: you may have noticed that you entered ":size :sides" in this order into the editor, and entered x 200 5 (reversed order) into the commander and it turned out correctly. I have no idea why this is reversed. if you figure it out, let me know. I'm curious. Factorial: factorials require their own program for calculation. Go to the LOGO editor and enter: to factorial :number if :number = 1 [output 1] output :number * factorial :number - 1 endClick "save and exit." Now that the factorial program has been created, enter into the commander, "print factorial n". For example, "print factorial 5". LOGO responds with the answer, 120. For factorials, LOGO is nothing more than a calculator. REVIEW: Using Flood Color In A LOGO Program: 1. the flood color can be set at any time by entering setfloodcolor [255 255 255] into the commander--where the numerical values entered are between 0 and 255. a) setfloodcolor [255 0 0] will set the flood color to red. b) setfloodcolor [255 255 255] will set the flood color to white. c) setfloodcolor [0 255 0] will set the flood color to green. d) setfloodcolor [0 0 255] will set the flood color to blue. e) setfloodcolor [0 0 0] will set the flood color to black. f) other colors are achieved by varying these numbers. 2. To flood an area with a color, the area to be flooded must be completely bounded by lines. 3. To flood an area with color, the LOGO pen must be placed inside the area to be colored. If it is merely on one of the boundary lines, it will color only that line. The pen is placed into an area using the pu command, followed by the movement commands which place the pen into the area to be flooded. 4. After the pen is placed inside the area to be flooded, enter the pd command followed by the fill command. The bounded area will be flooded with the selected color. Example: 1. Go to the LOGO editor and enter the following: to boxes repeat 4[fd 100 rt 90] repeat 4[fd 120 rt 90] repeat 4[fd 140 rt 90] repeat 4[fd 160 rt 90] repeat 4[fd 180 rt 90] repeat 4[fd 200 rt 90] repeat 4[fd 220 rt 90] repeat 4[fd 240 rt 90] repeat 4[fd 260 rt 90] repeat 4[fd 280 rt 90] repeat 4[fd 300 rt 90] end to color *pu rt 90 fd 3 lt 90 pd pu fd 110 setfloodcolor [255 0 0] pd fill pu fd 20 setfloodcolor [255 255 255] pd fill pu fd 20 setfloodcolor [255 0 0] pd fill pu fd 20 setfloodcolor [255 255 255] pd fill pu fd 20 setfloodcolor [255 0 0] pd fill pu fd 20 setfloodcolor [255 255 255] pd fill pu fd 20 setfloodcolor [255 0 0] pd fill pu fd 20 setfloodcolor [255 255 255] pd fill pu fd 20 setfloodcolor [255 0 0] pd fill pu fd 20 setfloodcolor [255 255 255] pd fill end *Note: The *pu rt 90 fd 3 lt 90 pd command brings the pen inside the areas to be colored, so that the pen will not merely be on a boundary line. Enter into the commander "boxes color" and our colored program(s) appears. To write words with LOGO, enter the command LABEL [text] with the [text] being the words you wish to write. For example: label [Reginald Van Williams III]. To write this name horizontally type: rt 90 label [Reginald Van Williams III]. You can make designs with your writing. For example, to make a square of Reginald Van Williams III, enter into the commander: lt 90 repeat 4[rt 90 label [***Reginald Van Williams III***]pu fd 300 pd]. To make a pentagon, enter: lt 90 repeat 5[rt 72 label [***Reginald Van Williams III***]pu fd 300 pd]. You may choose your font, size, and style by clciking "set" in the upper left portion of the LOGO screen. Then, clicking on "LABEL FONT" and make your selections. SAVING YOUR LOGO GRAPHICS To save your LOGO graphics, click "bitmap" at the top left of the LOGO screen. Then, click "save as," and select a name for your graphic. Then, choose where you would like the graphic to be saved; for example: "my documents." *Note: Even though you may have saved a program in the LOGO edior, this is temporary and will be deleted when you leave LOGO. To save your programs permanently, use the procedure above. MAKING SOUNDS WITH LOGO: To make a sound with LOGO, type into the commander: SOUND [1000 2000]. This will produce a sound with a frequency of 1000 and duration of 2 seconds. *Note: LOGO can be used to create music by downloading an additional (free) program called DRAWING WITH LOGO As an example of how to draw with LOGO, we will draw a house. Enter the following into the commander and it draws a simple house: pu lt 90 fd 150 rt 90 pd repeat 4[fd 250 rt 90]pu fd 250 pd lt 90 fd 40 rt 135 fd 233.5 rt 90 fd 233.5 rt 135 fd 40 However, the most beautiful LOGO art is created by programs that construct geometric patterns. Cut and paste a few of these into the LOGO commander, then try a few of your own: repeat 18[repeat 4[repeat 18[fd 10 rt 5] rt 180]rt 20] repeat 18[repeat 18[repeat 4[repeat 18[fd 10 rt 5] rt 160]rt 20] rt 20] repeat 4[repeat 9[repeat 4[repeat 9[fd 25 rt 10] repeat 9[ fd 25 lt 10] rt 160] lt 40] rt 90] LOGO has a variable called REPCOUNT. The repcount variable allows you to repeat a command and modify it with each repetition For example: repeat 20 [fd repcount * 5 rt 90] allows you to draw a square whose length is increased by 5 with each repetition. Try this one: repeat 200 [fd repcount *3 rt 90] Using the PU function in design:Some very attractive designed can be made utilizing the pu function. For example: repeat 36[repeat 36[fd 10 pu fd 10 pd rt 10]lt 10] or, repeat 72[repeat 4[repeat 4[fd 10 pu fd 20 pd fd 10] rt 90]lt 5] Ready for more LOGO? More LOGO Programs & LOGO Activities. You can also make music with LOGO! Check it out! Try These LOGO Commands Make Music With LOGO sum1no1nose@yahoo.com MSW LOGO Download. FMS LOGO Download Releases
|