Darwin the Goldfish
From The Amazing World of Gumball!
Darwin used to be the family pet until he sprouted legs and became one of the Wattersons. He’s innocent, naive and Gumball’s best friend. Make your own Darwin that will light up and make sounds when you shake him!
Prepare
This project
Level: Easy
Duration: 30 minutes
Flipgrid: https://flipgrid.com/740cd96d
Materials
Collect the materials in the list before starting your project Make.
- Adafruit Circuit Playground Express Base Kit
- A Wooden craft stick / paint stirrer stick
- Paper
- Crayons, colored markers or paint
- Tape (masking, duct tape, or packing tape)
- Scissors
Make
Step 1: Print or draw Darwin
You can either print out the image below or draw your own on a piece of paper (click on the Darwin below to view the full-size image and then print the page).
Step 2: Cut out Darwin’s head and shoes
Using scissors, cut out Darwin’s head and then cut out his shoes.
Step 3: Assemble Darwin
Tape Darwin’s head to the top of a wooden craft stick. Tape his shoes to the opposite end of the wooden craft stick.
Step 4: Color Darwin
Using crayons, colored markers or paint, color in Darwin’s body using orange, black, white and green.
Step 5: Attach the Adafruit Circuit Playground Express
Use a small piece of tape and roll it inside out to form a loop so that the sticky side is on the outside.
Place the tape over Darwin’s mouth, and use it to stick the Adafruit Circuit Playground Express onto the wooden craft stick.
Make sure the Adafruit Circuit Playground Express is placed so that the battery connector is at the bottom, to make it easier to connect the battery pack.
Step 6: Attach the Battery pack
Insert the batteries into the battery pack.
Using the wire, connect the battery pack to the Adafruit Circuit Playground Express.
Use a piece of tape to attach the battery pack to the back of the wooden craft stick. Note – if your battery pack includes a clip on the back, you may consider removing that.
Tape the battery wire to the back of the stick to hide it.
Complete!
Congratulations! You have made your own Darwin the Goldfish! Move on to the next step to code Darwin.
Code
Code Darwin to play a sound and show an animation when you shake him.
Concepts
- Motion Sensor, or Accelerometer (shake)
- Animation
- Pixels
- Sound
Blocks
light.setAll(0xff8000)
light.showAnimation(light.theaterChaseAnimation, 2000)
music.setVolume(200)
music.wawawawaa.play()
input.onGesture(Gesture.Shake, function () {})
Step 1: Turn on all lights orange
- Open MakeCode in your web browser
- Click on New Project
- Name your Project: Call it
Darwin
(note – you don’t need to click the Save button, just type the name)
- From the
||loops:LOOPS||
Toolbox drawer, drag out an||loops:on start||
block to the coding Workspace (note – you can ignore or delete the existing||loops:forever||
block on the workspace. Delete blocks by dragging them back over to the Toolbox menu)
- From the
||light:LIGHT||
Toolbox drawer, drag out a||light:set all pixels||
block to the Workspace, and drop it into the||loops:on start||
block
- In the
||light:set all pixels||
block, click on the color and select an Orange color
Step 2: Add an On Shake event
- From the
||input:INPUT||
Toolbox drawer, drag out an||input:on shake||
block onto the Workspace
Step 3: Play a Sound
- From the
||music:MUSIC||
Toolbox drawer, drag out a||music:play sound||
block to the coding Workspace, and drop it into the||input:on shake||
block - In the
||music:play sound||
block, click on the drop-down menu to select a sound of your choice
Step 4: Turn up the Volume!
- From the
||music:MUSIC||
Toolbox drawer, drag out a||music:set volume||
block to the coding Workspace, and drop it into the||loops:on start||
block - In the
||music:set volume||
block, click on the number and change the value to200
Step 5: Show an animation
- From the
||light:LIGHT||
Toolbox drawer, drag out a||light:show animation||
block to the coding Workspace, and drop it into the||input:on shake||
block, right after the||music:play sound||
block - In the
||light:show animation||
block, click on the animation drop-down menu to select your preferred animation
- In the
||light:show animation||
block, click on the number drop-down menu and select 2 seconds (2000
milliseconds)
Your final program may look something like this:
input.onGesture(Gesture.Shake, function () {
music.wawawawaa.play()
light.showAnimation(light.theaterChaseAnimation, 2000)
})
light.setAll(0xff8000)
music.setVolume(200)
Step 6: Download
Test your program in the Simulator by clicking the Shake button.
Once you’re happy with your program, click the Download button and follow the instructions to download the code to your Adafruit Circuit Playground Express.
Disconnect the Adafruit Circuit Playground Express from the USB cable, turn on the batteries, and try shaking Darwin.
Great work!