Welcome to Hackster!
Hackster is a community dedicated to learning hardware, from beginner to pro. Join us, it's free!
Santiago Vega
Published © GPL3+

DIG 3602 Project 2: Hoodie Soother

Using a sensor, a battery, some line of code and a hoodie, you can now walk around a gated community without getting arrested or shot!

BeginnerFull instructions provided3 hours686
DIG 3602 Project 2: Hoodie Soother

Things used in this project

Hardware components

Circuit Playground Express
Adafruit Circuit Playground Express
×1
USB-A to Micro-USB Cable
USB-A to Micro-USB Cable
×1
Rechargeable Battery, Lithium Ion
Rechargeable Battery, Lithium Ion
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Tape, Electrical
Tape, Electrical
Scissor, Electrician
Scissor, Electrician

Story

Read more

Schematics

Layout

Because I'm only using the sensors installed in my circuit board express, I won't be using any numerous or complex applications. I'm merely using the Circuit Playground Express with a lithium battery and tape.

Code

Rick Astley Sensor Code

JavaScript
Using MakeCode as a base, I used Javascript to recreate the first five chords of Rick Astley's hit single, "Never Gonna Give You Up". Additionally, I also increased the volume of the chords using 'setVolume' and created a changing pattern of red and blue to imitate police sirens.
input.onGesture(Gesture.ThreeG, function () {
    music.setVolume(255)
    music.playTone(220, music.beat(BeatFraction.Half))
    music.playTone(247, music.beat(BeatFraction.Half))
    music.playTone(294, music.beat(BeatFraction.Half))
    music.playTone(247, music.beat(BeatFraction.Half))
    music.playTone(349, music.beat(BeatFraction.Whole))
    music.playTone(349, music.beat(BeatFraction.Whole))
    music.playTone(330, music.beat(BeatFraction.Whole))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(220, music.beat(BeatFraction.Half))
    music.playTone(247, music.beat(BeatFraction.Half))
    music.playTone(294, music.beat(BeatFraction.Half))
    music.playTone(220, music.beat(BeatFraction.Half))
    music.playTone(330, music.beat(BeatFraction.Whole))
    music.playTone(330, music.beat(BeatFraction.Whole))
    music.playTone(294, music.beat(BeatFraction.Half))
    music.playTone(262, music.beat(BeatFraction.Half))
    music.playTone(247, music.beat(BeatFraction.Whole))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(220, music.beat(BeatFraction.Half))
    music.playTone(247, music.beat(BeatFraction.Half))
    music.playTone(294, music.beat(BeatFraction.Half))
    music.playTone(247, music.beat(BeatFraction.Half))
    music.playTone(294, music.beat(BeatFraction.Whole))
    music.playTone(330, music.beat(BeatFraction.Whole))
    music.playTone(262, music.beat(BeatFraction.Half))
    music.playTone(247, music.beat(BeatFraction.Half))
    music.playTone(220, music.beat(BeatFraction.Whole))
    music.rest(music.beat(BeatFraction.Half))
    music.playTone(220, music.beat(BeatFraction.Half))
    music.playTone(330, music.beat(BeatFraction.Whole))
    music.playTone(294, music.beat(BeatFraction.Whole))
})
input.onGesture(Gesture.TwoG, function () {
    for (let i = 0; i < 11; i++) {
        light.showRing(
        `red blue red blue red blue red blue red blue`
        )
        pause(100)
        light.showRing(
        `blue red blue red blue red blue red blue red`
        )
        light.clear()
    }
})

Credits

Santiago Vega
4 projects • 0 followers
Contact

Comments

Please log in or sign up to comment.