Matthias L. Jugel
Published © Apache-2.0

PaperSignal Klassenraum Lärmanzeige

Ist es zu Laut fällt Lernen schwer. Diese Google PaperSignal-Adaption zeigts an!

IntermediateFull instructions provided1 hour128
PaperSignal Klassenraum Lärmanzeige

Things used in this project

Hardware components

Calliope mini
Calliope mini
×1
Servos (Tower Pro MG996R)
Ich hab ein MicroServo benutzt: https://www.amazon.de/TradeFlair-TowerPro-SG90-Micro-Servo/dp/B00R4HLUA6
×1
Jumper wires (generic)
Jumper wires (generic)
×1

Software apps and online services

MakeCode
Microsoft MakeCode
https://makecode.calliope.cc

Story

Read more

Schematics

Wiring

Larm Hex File

Diese Datei kann direkt auf den Calliope mini gespielt werden oder ihr drag und dropped sie auf makecode.calliope.cc, dann habt ihr die Quellen!

Code

laerm

Typescript
Larmdetektor Calliope mini
let dummy = 0
let plot = 0
let mic = 0
let alterPlot = 0
let val = 0
alterPlot = 9999
basic.forever(() => {
    val = 0
    for (let i = 0; i < 100; i++) {
        mic = Math.abs(pins.analogReadPin(AnalogPin.MIC))
        val += pins.map(
            Math.abs(512 - mic),
            0,
            512,
            0,
            4
        )
    }
    plot = val / 100
    if (plot != alterPlot) {
        if (plot <= 1) {
            basic.setLedColor(Colors.Green)
            basic.showIcon(IconNames.Heart)
            pins.servoWritePin(AnalogPin.P1, 175)
        } else if (plot <= 2) {
            basic.setLedColor(Colors.Yellow)
            basic.showIcon(IconNames.StickFigure)
            pins.servoWritePin(AnalogPin.P1, 120)
        } else if (plot <= 3) {
            basic.setLedColor(Colors.Orange)
            basic.showIcon(IconNames.Ghost)
            pins.servoWritePin(AnalogPin.P1, 60)
        } else {
            basic.setLedColor(Colors.Red)
            basic.showIcon(IconNames.Skull)
            pins.servoWritePin(AnalogPin.P1, 0)
        }
        alterPlot = plot
        basic.pause(1000)
        dummy = pins.digitalReadPin(DigitalPin.P1)
    }
})

Credits

Matthias L. Jugel
4 projects • 10 followers
Hacker, dad. I flash devices for fun. Mostly stuff works for me...
Contact

Comments

Please log in or sign up to comment.