This Instructable can be modified for any major holiday, however my students wanted to focus on something they could do for Valentineâs Day. In this design, studentsâ hands are the conductive material that complete the circuit when they âhigh-fiveâ the two halves of the heart. When the circuit is complete, the âspaceâ input triggers a background change, a sprite costume change, and a âplay until finishedâ message of well wishes from each classroom. This program uses a variable to keep track of the classroom in charge of the message. There are heart left and right navigation âbuttonsâ that navigate between classes.
Supplies:
- 1 Makey Makey circuit board
- 5 alligator clips
- Conductive material (tin foil)
- Red 65lb paper (or construction paper)
- Electronic device that can run Scratch and has a usb port
- Tape (Scotch/transparent, Masking or Painterâs tape)
- https://scratch.mit.edu
- Scissors
Heart Halves
Use heavy (65lb), red construction or card-stock paper to cut out a heart. Then cut the heart in half. Cut tin foil (heavy) in a shape large enough to wrap each half of the heart. One half will be the ground, and the other will connect to the space-bar input. Press flat and use tape (Scotch or masking) to secure edges.
Navigation Hearts
Trace small hearts in the middle the halves. Use scissors or a blade to cut the small heart shapes out of the tin foil. Cut a rectangular strip of red construction or card-stock paper and trim the edges into points. Fold up edges. Tape the small tin foil hearts to the front of the strip â be sure the flaps will touch the center of the heart when folded over. Use one long piece of tin foil to cover the back of the strip and to wrap around the flaps â this will become the ground. Important note: Be sure to cut out a rectangle around the area where the left and right arrow alligator clips will touch the hearts â you do not want those clips to be in contact with the ground.
Step 2: Create the Background
My classes chose the use the heart shaped background provided by Scratch. We decided we wanted to duplicate and edit each background so that we would have three different colors (red/pink, purple, blue) to cycle through each time the Heart Circuit (space-bar event) was activated. We used the fill tool on each duplicate to create three different color patterns. There is no code on the background images.
Step 3: Create the Code
Some like to connect the Makey Makey to the circuit (conductive materials) prior to writing the program, however I prefer students create the code first in order to understand what each event will trigger. They can debug the code prior to connecting it to the final product.
There are two areas where code is added
- The Candy Heart Sprite
- The Class Name Sprite
Step 4: Program the Candy Heart Sprite
The Candy Heart Sprite is where the majority of the code for this program lies. This Sprite is one found in Scratchâs Sprite Bank. The code relies on nested if, else statements to check class number the variable âClassâ is set to and adjust the sound it plays according to the class number. When played, the class variable is changed to the next class. This continues until the last class number, which resets the variable to 0 and starts the classes over in an endless loop.
First we want to establish what background, costume, and values our âClassâ variable will start on.
- When run
- change backdrop to first
- change Heart Candy Costume to first
- Set class = 0
Then we want to add the code for what will happen when we input space-bar:
- When âspaceâ event
- Change to next backdrop
- Change to next Heart Candy Costume
- IF, else (variable) âClassâ = 0
- Play âClass 0 Happy Valentineâs Dayâ sound, until done
- Change âClassâ by 1
- Wait 1 second [this prevents activation of the code multiple times]
- ELSE
- IF, else âClassâ = 1
- Play âClass 1 Happy Valentineâs Dayâ sound, until done
- Change âClassâ by 1
- Wait 1 second
- ELSE
- IF, else âClassâ = 2
- Play âClass 2 Valentineâs Dayâ sound, until done
- Change âClassâ by 1
- Wait 1 second
- ELSE
- IF, else âClassâ = 3
- Play âClass 3 Valentineâs Dayâ sound, until done
- Change âClassâ by 1
- Wait 1 second
- ELSE [This is the final nested IF, ELSE statement of our code, however you could add as many as needed]
- Play âClass 4 Valentineâs Dayâ sound, until done
- Set âClassâ to 0 [this resets the program back to step one]
- IF, else âClassâ = 3
- IF, else âClassâ = 2
- IF, else âClassâ = 1
Step 5: Program the Class Names Sprite
Create Sprite Class Names
We created a sprite and drew a rectangular box in the middle. We then added the name of our first class inside the box. We used the new centering feature in Scratch 3.0 to make sure the text and the rectangle appeared centered. Finally, we duplicated the sprite to create 5 different costumes, editing the text inside of each costume and renaming them to reflect their classroom name.
Create the Code
In the code for this sprite, we want the buttons to listen for input for the duration of the program and freely change the âClassâ variable either forward by one or backward by one depending on which navigation button we press. This will allow the class name to appear whenever the variable is at a specific number and tell the Heart code which classroom sound to play.
- When run
- FOREVER
- IF âClassâ = 0
- switch costume âClass 0â
- IF âClassâ = 1
- switch costume âClass 1â
- IF âClassâ = 2
- switch costume âClass 2â
- IF âClassâ = 3
- switch costume âClass 3â
- IF âClassâ = 4
- switch costume âClass 4â
- IF âClassâ = 0
- FOREVER
Then add the When Left Arrow and When Right Arrow code. This code can be added in either the Class Name sprite or in the Heart Candy sprite (as pictured).
- When left arrow pressed
- change âClassâ by -1
- When right arrow pressed
- change âClassâ by 1
Step 6: Create the Open Circuits
After mounting the âBroken Heartâ Halves (be sure the halves do not touch) and Navigation Hearts, itâs time to attach the pieces to your Makey Makey board and create the two open circuits.
Ground 1
Attach one end of an alligator clip cable to one side of the Heart and the other end to the top-side GROUND bar.
Ground 2
Attach one end of an alligator clip cable to the middle of the navigation bar, making sure it touches the tin foil on the back of the strip which then wraps around the pointed ends, and then the other end to the top-side GROUND bar.
Space
Attach one end of an alligator clip cable to the other side of the Heart and then the other end to the top-side SPACE input.
Left
Attach one end of an alligator clip cable to the left heart on the navigation bar and then the other end to the top-side LEFT input.
Right
Attach one end of an alligator clip cable to the right heart on the navigation bar and then the other end to the top-side RIGHT input.
Plug your Makey Makey board into your device using the USB cable.
Source: Set @Holiday = Valentines_Day