Ethan Osbornejweber76
Published

The LED Head Banger - Sensory Intervention

A hat hooked up to a cpx with a cardboard covering that when tilted to certain angles lights up with LED colors and plays musical notes.

BeginnerFull instructions provided2 hours39
The LED Head Banger - Sensory Intervention

Things used in this project

Hardware components

Adafruit lithium Ion Battery
×1
Circuit Playground Express
Adafruit Circuit Playground Express
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Scissor, Electrician
Scissor, Electrician
Tape, Duct
Tape, Duct
cardboard
hat

Story

Read more

Schematics

Demonstration of Hat working as intended

Shake that head then BAM. Music and lights happen!

Code

Head Banger Code

JavaScript
Simply Tilt the CPX different directions to light up the LEDs to certain colors and play certain musical notes.
input.onGesture(Gesture.TiltLeft, function () {
    light.showRing(
    `green green green green green green green green green green`
    )
    music.playTone(262, music.beat(BeatFraction.Whole))
})
input.onGesture(Gesture.TiltRight, function () {
    light.showRing(
    `yellow yellow yellow yellow yellow yellow yellow yellow yellow yellow`
    )
    music.playTone(220, music.beat(BeatFraction.Whole))
})
input.onGesture(Gesture.FaceUp, function () {
    light.showRing(
    `blue blue blue blue blue blue blue blue blue blue`
    )
    music.playTone(523, music.beat(BeatFraction.Whole))
})
input.onGesture(Gesture.TiltUp, function () {
    light.showRing(
    `black black black black black black black black black black`
    )
})
input.onGesture(Gesture.TiltDown, function () {
    light.showRing(
    `white white white white white white white white white white`
    )
})
input.onGesture(Gesture.FaceDown, function () {
    light.showRing(
    `red red red red red red red red red red`
    )
    music.playTone(131, music.beat(BeatFraction.Whole))
})
music.setVolume(255)

Credits

Ethan Osborne
4 projects • 2 followers
Contact
jweber76
4 projects • 1 follower
Contact
Thanks to Jamie Cheaw.

Comments

Please log in or sign up to comment.