Ethan Osborne
Published

The Red Alert Alarm

The Red Alert Alarm is basically an alarm that lights up red, does not stop until you turn it off and the pitch/volume can be adjusted.

BeginnerFull instructions provided1 hour53
The Red Alert Alarm

Things used in this project

Hardware components

Adafruit lithium ion battery
×1
Alligator Clips
Alligator Clips
×1
Circuit Playground Express
Adafruit Circuit Playground Express
×1
Rotary Potentiometer, 1 Mohm
Rotary Potentiometer, 1 Mohm
×1
Adafruit toggle switch
×1

Software apps and online services

MakeCode
Microsoft MakeCode

Hand tools and fabrication machines

Scissor, Electrician
Scissor, Electrician
Tape, Clear
Tape, Clear
sharpie

Story

Read more

Schematics

How to use the Alarm

A video showcasing how to turn on and off the alarm as well as how to adjust volume/pitch.

Code

Basic Switch and Knob

JavaScript
You turn on the device using the toggle switch, by default it is turned off, once it is on the lights will turn red and the alarm will be playing, and you will be able to control the pitch and volume with the potentiometer.
/**
 */
let value = 0
pins.A1.setPull(PinPullMode.PullUp)
music.setVolume(255)
forever(function () {
    if (pins.A1.digitalRead()) {
        value = pins.A7.analogRead()
        light.setAll(0xff0000)
        music.playTone(value, music.beat(BeatFraction.Eighth))
        pause(500)
    } else {
        light.clear()
        music.stopAllSounds()
    }
})

Credits

Ethan Osborne
4 projects • 2 followers
Contact

Comments

Please log in or sign up to comment.