Heather Parrett
Published

Musical Manatee

This projects utilizes the onboard accelerometer of a Circuit Playground Express from Adafruit.

BeginnerShowcase (no instructions)4 hours494
Musical Manatee

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Sewing Machine

Story

Read more

Code

Project Code

JavaScript
input.onGesture(Gesture.Shake, function () {
    music.setVolume(255)
    music.playTone(523, music.beat(BeatFraction.Half))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(466, music.beat(BeatFraction.Half))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(415, music.beat(BeatFraction.Half))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(392, music.beat(BeatFraction.Half))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(349, music.beat(BeatFraction.Whole))
    music.rest(music.beat(BeatFraction.Sixteenth))
    music.playTone(349, music.beat(BeatFraction.Half))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(349, music.beat(BeatFraction.Whole))
    music.rest(music.beat(BeatFraction.Sixteenth))
    music.playTone(349, music.beat(BeatFraction.Half))
})
let rot_x = 0
let accel_x = 0
input.setAccelerometerRange(AcceleratorRange.TwoG)
forever(function () {
    accel_x = input.acceleration(Dimension.X)
    rot_x = input.rotation(Rotation.Pitch)
})

Credits

Heather Parrett

Heather Parrett

4 projects • 0 followers

Comments