Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
austin menard
Published

CPX Star Wars Piano

A piano made up of wood and aluminium foil, consisting of six notes that play the main theme of Star Wars.

BeginnerFull instructions provided5 hours211
CPX Star Wars Piano

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
Battery, 3.7 V
Battery, 3.7 V
×1
Alligator Clips
Alligator Clips
×1
Wood
×1
Aluminium foil
×1

Story

Read more

Code

Six note music code

JavaScript
input.pinA1.onEvent(ButtonEvent.Down, function () {
    music.playTone(233, music.beat(BeatFraction.Half))
    music.setVolume(255)
})
input.pinA2.onEvent(ButtonEvent.Down, function () {
    music.playTone(349, music.beat(BeatFraction.Half))
    music.setVolume(255)
})
input.pinA3.onEvent(ButtonEvent.Down, function () {
    music.playTone(311, music.beat(BeatFraction.Half))
    music.setVolume(255)
})
input.pinA4.onEvent(ButtonEvent.Down, function () {
    music.playTone(294, music.beat(BeatFraction.Half))
    music.setVolume(255)
})
input.pinA5.onEvent(ButtonEvent.Down, function () {
    music.playTone(262, music.beat(BeatFraction.Half))
    music.setVolume(255)
})
input.pinA6.onEvent(ButtonEvent.Down, function () {
    music.playTone(466, music.beat(BeatFraction.Half))
    music.setVolume(255)
})

Credits

austin menard
4 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.