Get ready for your New Year's Party with our DIY Party Pack!

Fraction Generator with Makey Makey and Scratch

Add a physical computing element to your fraction lessons with this guide on using Makey Makey and Scratch to generate fractions! Gather your supplies and let's go!

Use Conductive Tape to Map Measurements

First, decide what you want to measure and how you should create equivalent fractions for the measuring device you are using. In this tutorial, we chose 1/4,1/2,3/4, and 1 cup because we could easily measure it.

To get an accurate measurements, we even converted ml to cup measurements. Place a piece of tape for 1/4,1/2, 3/4, and be sure the tape for each measurement does not touch!

Create EARTH by placing a piece of tape from the bottom of the cup to the top of the handle as pictured.

To hook up Makey Makey, Clip an alligator clip to each tape trace. When you pour water (or Orbeez) in the cup, you will complete the circuit for each measured spot.

We've marked this template with the key presses we used. You can use different key presses, but make sure to adjust your code in the next step if you do so!

 

Option 1: Code Scratch Project Using Logic

Choose two sprites (or remix our project).

To generate fractions on the screen, we created costumes for our sprite that would change with each measurement. We used the cat sprite to speak the measurements, but hid that sprite behind our measuring cup!

You can choose to teach kids about Boolean operators as logic statements to create your measurement code or go to the next step of this guide and teach students how to make nested if statements.

Logic Statements and Computer Science

A Boolean statement can be either true or false. So for our code to work, we have to create statements that tell the computer when to portray each measurement.

 

  • AND: Use AND if you want to combine key presses to make a statement true. For example, 1/2 cup is true if key space AND key A is pressed.
  • NOT: If you want a statement to be true when nothing is pressed or only when the other keys are not pressed, you will use NOT. For example, we want our cup to be empty when NO KEYS are pressed. The cup is empty if SPACE, A, and Down are NOT pressed.
  • OR: Use OR if you want either item to make your statement true. We used OR to show that 1/4 would be true if neither key A or key Down is pressed.

Create your code and try moving if statements around. Does it effect your measuring if you place the if statements in a different order? Why do you think this effects the code?

Make sure you wrap everything in a FOREVER loop or your code will only check these if statements on the start of the program. A forever loop allows the computer to keep checking for key presses.

To test each of these sets of key-presses using IF statements and AND Logic in Scratch:

WHEN [flag] clicked

FOREVER

IF <NOT (key [space] pressed?) OR (key [down arrow] pressed?) OR (key [a] pressed?) > THEN

switch costume to [measuring cup]

IF <(key [space] pressed?) AND NOT(key [a} pressed?) OR (key [down arrow] pressed?) >THEN

switch costume to [1/4 cup}

IF <(key [space] pressed?) AND (key [a] pressed?) AND NOT (key [down arrow} pressed?)> THEN

switch costume to [1/2 cup]

IF <(key [space] pressed?) AND (key [a] pressed?) AND (key [down arrow} pressed?)> THEN

switch costume to [3/4 cup]

IF <(key [space] pressed?) AND (key [a] pressed?) AND (key [down arrow} pressed?) AND (key [right arrow} pressed?)> THEN

switch costume to [1 cup]

Option 2: Code Scratch Project Using Nested If Statements

To code with If statements, you'll still have to think about the order of your blocks.

Create two sprites or remix our "Nested If Statements" project. Without the Boolean logic, these key presses will trigger even if you don't use AND. (But this also means they will trigger if you press a key without pressing the coordinating key.)

To make this code work, you'll need to start with the fullest measurement and nest if statements into one another, so the computer is checking for the fullest measurement first.

Each piece of tape on the cup corresponds to a key press on the Makey Makey.

Essentially we want the code to read:

WHEN the cup is empty:

no keys are pressed

WHEN the cup is 1/4 full:

'space' key is pressed

WHEN the cup is 1/2 full

'a' keys is pressed

WHEN the cup is 3/4 full

down-arrow key is pressed

WHEN the cup is full

right-arrow keys is pressed

 

For the simplest coding option, we can test each of these sets of key-presses using IF-THEN statements in Scratch:

IF <(key [right arrow] pressed?)> THEN

switch costume to [1 cup]

ELSE

IF <(key [down arrow] pressed?)> THEN

switch costume to [3/4 cup]

ELSE

IF <(key [a] pressed?)> THEN

switch costume to [1/2 cup]

ELSE

IF <(key [space] pressed?) > THEN

switch costume to [1/4 cup]

ELSE

switch costume to [empty]

 

You can add the AND/OR logic back if you want the fractions to ONLY be generated when pressing key combinations.

 

WHEN the cup is empty:

no keys are pressed

WHEN the cup is 1/4 full:

'space' key is pressed

WHEN the cup is 1/2 full

'space' key AND 'a' keys are pressed

WHEN the cup is 3/4 full

'space' key AND 'a' key AND down-arrow keys are pressed

WHEN the cup is full

'space' key AND 'a' key AND down-arrow key AND right-arrow keys are pressed

 

Now we can also test each of these sets of key-presses using IF-THEN statements in Scratch:

IF <(key [space] pressed?) AND (key [a] pressed?) AND (key [down arrow] pressed?) AND (key [right arrow] pressed?)> THEN

switch costume to [1 cup]

ELSE

IF <(key [space] pressed?) AND (key [a] pressed?) AND (key [down arrow] pressed?)> THEN

switch costume to [3/4 cup]

ELSE

IF <(key [space] pressed?) AND (key [a] pressed?) > THEN

switch costume to [1/2 cup]

ELSE

IF <(key [space] pressed?) > THEN

switch costume to [1/4 cup]

ELSE

switch costume to [empty]

 

 

 Generate Fractions!

Once your program is good to go and you've hooked up your Makey Makey, you are ready to generate fractions! To keep your computer safe, use Orbeez (waterbeads) to make your measurements. As you pour in the water beads, you will complete the circuit for each measurement and your computer will show what measurements you've made!


Extensions:

Use Scratch to create equivalent fractions or create a code that asks players to name equivalent fractions with the ASK and ANSWER blocks!

 

Time Investment
Up to 1 hour
Grades:
4- 12+

Supplies

Download

Download PDF copy of this Guide

N/A

Welcome

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aenean pharetra, ligula non mollis pretium, lectus libero sodales augue, interdum auctor mauris dui non risus. Nulla facilisi. Nunc rutrum diam in elit sagittis eget viverra erat viverra. Morbi imperdiet aliquet libero vel rhoncus. Integer.