Book Image

Scratch Cookbook

By : Brandon Milonovich
Book Image

Scratch Cookbook

By: Brandon Milonovich

Overview of this book

Scratch 2.0 is an easy to use programming language that allows you to animate stories and create interactive games. Scratch also gives you the capability of using programming to calculate complicated calculations for you. Scratch Cookbook will lead you through easy-to-follow recipes that give you everything you need to become a more advanced programmer. Scratch Cookbook will take you through the essential features of Scratch. You'll then work through simple recipes to gain an understanding of the more advanced features of Scratch. You will learn how to create animations using Scratch. Sensory board integration (getting input from the outside environment) will also be covered, along with using Scratch to solve complicated and tedious calculations for you. You'll also learn how to work through the exciting process of project remixing where you build on the work of others. Scratch Cookbook will give you everything you need to get started with building your own programs in Scratch that involve sounds, animations, and user interaction.
Table of Contents (17 chapters)
Scratch Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Measuring resistance


Resistance, which can be thought of as how easily electricity flows through something, can be measured (informally) using Scratch. This recipe is going to get us going in collecting resistance values.

Getting ready

This will be a recipe that will work with the resistance of two different items, so we'll use two sets of alligator clips. We'll create a program that will check the resistance of two objects, and will let the operator know which object has a higher resistance.

Set up the PicoBoard with two of the alligator clips, as shown here:

Now you're ready to get started!

How to do it...

Follow these steps to make our program that will check the resistance of two objects:

  1. Open a new Scratch file.

  2. Drag over a block.
  3. Drag three if statements underneath the block from step 2. This will result in the following:

  4. Drag one of each of the three blocks from the Operators category that compare values into the conditional statements you just created.

    This should result in the following...