
C H A P T E R 1 1
A N I N T R O D U C T I O N T O S C R A T C H
171
Robotics and Sensors
In addition to purely software-based inputs and outputs, it’s also possible to tie Scratch into
external hardware using sensor boards and robotics systems. Thanks to its multithreaded
nature and powerful inter-process messaging system, Scratch can be used to create a surpris-
ingly advanced robotics engine and is by far the easiest way to place a Raspberry Pi at the
heart of a simple robot.
Unlike Python, which is a more powerful but significantly more complex programming lan-
guage, Scratch can’t make use of the Raspberry Pi’s GPIO port to communicate with external
hardware. As a result, it needs some additional equipment before it can interact with the
physical world.
Sensing with the PicoBoard
Designed by the SparkFun electronics company, the PicoBoard is an add-on module that
connects to a computer running Scratch and provides a variable slider input, a light sensor, a
button, a sound sensor and four pairs of alligator clips that can be used to monitor external
electrical devices.
There are currently two types of PicoBoard: the original model, which uses a serial connec-
tion, and its replacement, which uses a USB connection. The latter is supported by the
Raspberry Pi. Simply connect it to a free USB port or a port on a USB hub connected to the
Pi, restart Scratch, and you’ll be able to use its various functions within the Scratch interface.
Details on the PicoBoard can be found at
http://www.sparkfun.com/products/
10311
.
Robotics with LEGO
In addition to add-in sensor modules, it’s possible to control an external robotics system
through Scratch. The LEGO Education WeDo robotics kit is designed to connect motors,
distance sensors and speed sensors to a computer—all of which can be controlled using spe-
cialised blocks found in Scratch.
For children, the WeDo kit is an excellent way to get started with robotics: the components
clip together just like regular LEGOs, and there are no risks of receiving an electric shock
should anything be badly connected. The WeDo kit boasts compatibility with regular LEGO
and LEGO Technik kits, too, meaning it’s possible to build large projects quickly and easily.
More information on using a LEGO Education WeDo kit with Scratch can be found at
http://info.scratch.mit.edu/WeDo
.
Summary of Contents for A
Page 1: ......
Page 2: ......
Page 3: ...Raspberry Pi User Guide 2nd Edition...
Page 4: ......
Page 5: ...Raspberry Pi User Guide 2nd Edition Eben Upton and Gareth Halfacree...
Page 10: ......
Page 26: ...R A S P B E R R Y P I U S E R G U I D E S E C O N D E D I T I O N 10...
Page 28: ......
Page 29: ...Chapter 1 Meet the Raspberry Pi...
Page 37: ...Chapter 2 Getting Started with the Raspberry Pi...
Page 56: ......
Page 57: ...Chapter 3 Linux System Administration...
Page 79: ...Chapter 4 Troubleshooting...
Page 89: ...Chapter 5 Network Configuration...
Page 109: ...Chapter 6 The Raspberry Pi Software Configuration Tool...
Page 122: ......
Page 123: ...Chapter 7 Advanced Raspberry Pi Configuration...
Page 140: ......
Page 141: ...Chapter 8 The Pi as a Home Theatre PC...
Page 151: ...Chapter 9 The Pi as a Productivity Machine...
Page 160: ......
Page 161: ...Chapter 10 The Pi as a Web Server...
Page 172: ......
Page 173: ...Chapter 11 An Introduction to Scratch...
Page 189: ...Chapter 12 An Introduction to Python...
Page 216: ......
Page 218: ......
Page 219: ...Chapter 13 Learning to Hack Hardware...
Page 234: ......
Page 235: ...Chapter 14 The GPIO Port...
Page 249: ...Chapter 15 The Raspberry Pi Camera Module...
Page 265: ...Chapter 16 Add on Boards...
Page 280: ......
Page 281: ...Appendix A Python Recipes...
Page 287: ...Appendix B Raspberry Pi Camera Module Quick Reference...
Page 293: ...Appendix C HDMI Display Modes...