Skip to Main Content
Adventures in Raspberry Pi, 2nd Edition
book

Adventures in Raspberry Pi, 2nd Edition

by Carrie Anne Philbin
February 2015
Beginner content levelBeginner
256 pages
5h 13m
English
Wiley
Content preview from Adventures in Raspberry Pi, 2nd Edition
9781119046028-co0401.tif

SUPPOSE YOU COULD pick up a turtle, dip his tail into coloured ink, place him on a piece of paper and make him walk around so that his tail paints a spiral shape, a pentagon or a noughts and crosses grid? This adventure introduces you to different ways that you can create shapes or line drawings using code.

You’ll use a module called Turtle Graphics that works by directing a cursor (or turtle) around the screen using movement instructions; see an example of the result in Figure 4-1. This movement leaves a colour trail like a pen, which means you are able to program a computer to draw. Turtle Graphics was originally a feature of the programming language LOGO (Logic Oriented Graphic Oriented), which was designed to teach young people how to program using a logical sequence of steps by means of an onscreen cursor called a turtle. LOGO continues to be a very popular way to learn logic and sequencing in computer programming. Both Scratch and Python include turtle modules that can be used to create shapes, drawings and patterns.

This adventure draws on many of the computing concepts you have already used in previous tutorials in this book, such as sequencing, variables and loops, to create shapes and spirals in both Scratch and Python programming environments on the Raspberry Pi.

.tif
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Experimenting with Raspberry Pi

Experimenting with Raspberry Pi

Warren W. Gay

Publisher Resources

ISBN: 9781119046059Purchase book