revoke loudness block

This commit is contained in:
Amerlander 2020-08-22 11:07:04 +02:00
parent 0c360e9a5d
commit 8700349d68

View File

@ -77,29 +77,4 @@ namespace input {
export function runningTimeMicros() {
return control.micros();
}
/**
* gets the level of loudness in 0-100%
*/
//% blockId="loudness"
//% block="Loudness"
export function loudness(): number {
let value = 0
let max = 0
let min = 1023
for (let index = 0; index < 32; index++) {
value = pins.analogReadPin(50)
if (value > max) {
max = value
} else if (value < min) {
min = value
}
}
value = (max - min) * 977 / 10000
return value
}
}