Hackster is hosting Hackster Holidays, Ep. 6: Livestream & Giveaway Drawing. Watch previous episodes or stream live on Monday!Stream Hackster Holidays, Ep. 6 on Monday!
Michelle T
Published © GPL3+

Save the Bees, Little Bumblebee

To bring awareness about saving the bees, this little crocheted bumblebee is here to support the cause at the cost of his own wellbeing.

IntermediateShowcase (no instructions)5 hours207
Save the Bees, Little Bumblebee

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
Li-Ion Battery 1000mAh
Li-Ion Battery 1000mAh
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Black Yarn
Yellow Yarn
White Yarn
Black Pom-poms
Polyester Stuffing

Story

Read more

Code

Bumblebee

Makefile
Utilizing the accelerometer on the CPX, when the CPX is tilted further than 90 degrees in it's X or Y axis, it would play a snippet from "Flight of the Bumblebee" and flash red lights, signaling the demise of the bumblebee.
No preview (download only).

Bumblebee JavaScript

JavaScript
function Bumblebee() {
    music.playTone(659, music.beat(BeatFraction.Eighth))
    music.playTone(622, music.beat(BeatFraction.Eighth))
    music.playTone(587, music.beat(BeatFraction.Eighth))
    music.playTone(554, music.beat(BeatFraction.Eighth))
    music.playTone(587, music.beat(BeatFraction.Eighth))
    music.playTone(554, music.beat(BeatFraction.Eighth))
    music.playTone(523, music.beat(BeatFraction.Eighth))
    music.playTone(494, music.beat(BeatFraction.Eighth))
    music.playTone(523, music.beat(BeatFraction.Eighth))
    music.playTone(494, music.beat(BeatFraction.Eighth))
    music.playTone(466, music.beat(BeatFraction.Eighth))
    music.playTone(440, music.beat(BeatFraction.Eighth))
    music.playTone(415, music.beat(BeatFraction.Eighth))
    music.playTone(392, music.beat(BeatFraction.Eighth))
    music.playTone(370, music.beat(BeatFraction.Eighth))
    music.playTone(349, music.beat(BeatFraction.Eighth))
    music.playTone(330, music.beat(BeatFraction.Eighth))
    music.playTone(311, music.beat(BeatFraction.Eighth))
    music.playTone(294, music.beat(BeatFraction.Eighth))
    music.playTone(277, music.beat(BeatFraction.Eighth))
    music.playTone(294, music.beat(BeatFraction.Eighth))
    music.playTone(277, music.beat(BeatFraction.Eighth))
    music.playTone(262, music.beat(BeatFraction.Eighth))
    music.playTone(247, music.beat(BeatFraction.Eighth))
    music.playTone(262, music.beat(BeatFraction.Eighth))
    music.playTone(247, music.beat(BeatFraction.Eighth))
    music.playTone(233, music.beat(BeatFraction.Eighth))
    music.playTone(220, music.beat(BeatFraction.Eighth))
    music.playTone(208, music.beat(BeatFraction.Eighth))
    music.playTone(196, music.beat(BeatFraction.Eighth))
    music.playTone(185, music.beat(BeatFraction.Eighth))
    music.playTone(175, music.beat(BeatFraction.Eighth))
    music.playTone(165, music.beat(BeatFraction.Eighth))
    music.playTone(156, music.beat(BeatFraction.Eighth))
    music.playTone(147, music.beat(BeatFraction.Eighth))
    music.playTone(139, music.beat(BeatFraction.Eighth))
    music.playTone(147, music.beat(BeatFraction.Eighth))
    music.playTone(139, music.beat(BeatFraction.Eighth))
    music.playTone(131, music.beat(BeatFraction.Eighth))
    music.playTone(130, music.beat(BeatFraction.Eighth))
}
let roll = 0
let pitch = 0
music.setVolume(245)
forever(function () {
    pitch = input.rotation(Rotation.Pitch)
    roll = input.rotation(Rotation.Roll)
    if (Math.abs(pitch) <= 50 && Math.abs(roll) >= 130) {
        light.stopAllAnimations()
        music.stopAllSounds()
        control.runInParallel(function () {
            light.showAnimation(light.theaterChaseAnimation, 20000)
        })
        Bumblebee()
    } else {
        light.stopAllAnimations()
        music.stopAllSounds()
    }
})

Credits

Michelle T

Michelle T

4 projects • 0 followers

Comments