Maximillan Brown
Published

SOS Jar

The SOS Jar is a jar that features a switch. Turning the switch on for the lights inside the jar to light up and morse code for "SOS"

BeginnerShowcase (no instructions)451
SOS Jar

Story

Read more

Code

Code from Microsoft Makecode

JavaScript
This code detect's if the switch connected to the ground and A1 pin on the Adafruit Circuit Playground Express (CPX) is turned on. If the switch is on, the lights on the Adafruit CPX will light up and the soundboard will play morse code for "SOS".
pins.A1.setPull(PinPullMode.PullUp)
forever(function () {
    if (!(pins.A1.digitalRead())) {
        light.showAnimation(light.rainbowAnimation, 500)
        music.playMelody("A A A - G - G - ", 190)
        music.playMelody("G - A A A - - - ", 190)
    } else {
        light.clear()
    }
})

Credits

Maximillan Brown
4 projects • 0 followers

Comments