Will Sagen
Published © CC0

Türklingel mit Bewegungssensor (Motion activated Doorbell)

Ein Grove-PIR-Sensor (am rechten Anschluss) wird ausgelesen. Wenn sich der Wert auf "1" ändert, wird ein C-Dur-Akkord gespielt.

BeginnerProtip400
Türklingel mit Bewegungssensor (Motion activated Doorbell)

Things used in this project

Hardware components

PIR-Motion-Sensor
×1
Calliope mini
Calliope mini
×1

Story

Read more

Code

Türklingel

JavaScript
Uses PIR-Sensor on dig PIN C16 and Onboard-Speaker
basic.forever(() => {
    pins.setPull(DigitalPin.C16, PinPullMode.PullNone)
    if (pins.digitalReadPin(DigitalPin.C16) == 1) {
        basic.setLedColor(Colors.Red)
        music.playTone(262, music.beat(BeatFraction.Whole))
        music.playTone(330, music.beat(BeatFraction.Whole))
        music.playTone(392, music.beat(BeatFraction.Whole))
    } else {
        basic.setLedColor(Colors.Green)
    }
})

Credits

Will Sagen

Will Sagen

0 projects • 0 followers

Comments