Final Project: Elephant Stage

For my final project I decided to do an elephant on a stage that lights up and plays music. You would put the elephant on a button and a sensor would make an Led strip light up and play music. I was inspired to create this by old cartoon shows and circus shows.

Materials:

  • Cardboard
  • Construction paper
  • Hot Glue gun
  • Tape
  • Toy plush
  • Arduino
  • Aligator clips
  • Button
  • Led strip

Step 1:

Cut out and glue cardboard into shape of a box. or for more stability, use a shoe box. Decorate Box as you please, I used paper.

Step 2:

Program Arduino with desired music. I choose the disney song one upon a dream. I individually programmed each note into the code. However, you can choose whatever song you’d like to do that can be found online.

step 3:

Connect alligator strips from arduino to button, speaker, and Led strip. See picture for reference.

Step 4:

Put the arduino and the alligator wires inside the box, and the led strip outside the box. The button should go on top. This is what it should look like:

Code: https://makecode.com/_L6fCmTFw10ha

input.pinA1.onEvent(ButtonEvent.Click, function () {
animating = !(animating)
if(!(animating)){
control.reset()
}elseif(animating){
intro_1()
}
})
function intro () {
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Double))
music.playTone(370,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Whole))
}
function intro_2 () {
music.playTone(523,music.beat(BeatFraction.Double))
music.playTone(494,music.beat(BeatFraction.Double))
music.playTone(466,music.beat(BeatFraction.Double))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Double))
music.playTone(523,music.beat(BeatFraction.Whole))
music.rest(music.beat(BeatFraction.Sixteenth))
music.playTone(523,music.beat(BeatFraction.Double))
music.playTone(494,music.beat(BeatFraction.Whole))
music.rest(music.beat(BeatFraction.Sixteenth))
music.playTone(494,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
intro_3()
}
input.pinA2.onEvent(ButtonEvent.Click, function () {
control.reset()
})
function Quiet () {
control.reset()
music.stopAllSounds()
music.rest(music.beat(BeatFraction.Breve))
pause(100)
light.stopAllAnimations()
light.showAnimationFrame(light.rainbowAnimation)
strip2.stopAllAnimations()
strip2.showAnimationFrame(light.rainbowAnimation)
}
function intro_4 () {
music.playTone(494,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(523,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Double))
music.playTone(523,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(659,music.beat(BeatFraction.Double))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(698,music.beat(BeatFraction.Whole))
music.playTone(659,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(523,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Sixteenth))
music.playTone(523,music.beat(BeatFraction.Whole))
music.playTone(622,music.beat(BeatFraction.Whole))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(523,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Double))
music.playTone(587,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Double))
music.playTone(698,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Breve))
}
function intro_1 () {
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(392,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Double))
music.playTone(370,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Double))
music.rest(music.beat(BeatFraction.Whole))
intro_2()
}
function intro_3 () {
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(330,music.beat(BeatFraction.Double))
music.playTone(349,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(330,music.beat(BeatFraction.Whole))
music.playTone(349,music.beat(BeatFraction.Whole))
music.playTone(370,music.beat(BeatFraction.Whole))
music.playTone(392,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(440,music.beat(BeatFraction.Double))
music.playTone(294,music.beat(BeatFraction.Whole))
music.playTone(466,music.beat(BeatFraction.Double))
intro_4()
}
let strip2: light.NeoPixelStrip = null
let animating = false
animating = false
strip2 = light.createStrip(pins.A7, 30)
light.stopAllAnimations()
light.showAnimationFrame(light.rainbowAnimation)
strip2.stopAllAnimations()
strip2.showAnimationFrame(light.rainbowAnimation)
forever(function () {
if(animating){
light.showAnimation(light.cometAnimation,100)
strip2.showAnimation(light.cometAnimation, 100)
}
})