This commit is contained in:
Juri
2020-08-19 22:03:58 +02:00
parent 4ef7b9318f
commit 3152215415
291 changed files with 9511 additions and 2966 deletions

View File

@ -0,0 +1,6 @@
{
"input": "Events and data from sensors",
"input.onLoudSound": "Registers an event that runs when a loud sound is detected",
"input.setLoudSoundThreshold": "Sets the minimum threshold for a loud sound",
"input.soundLevel": "Reads the loudness through the microphone from 0 (silent) to 255 (loud)"
}

View File

@ -0,0 +1,10 @@
{
"LoudnessCondition.Loud|block": "loud",
"LoudnessCondition.Quiet|block": "quiet",
"input.onLoudSound|block": "on loud sound",
"input.setLoudSoundThreshold|block": "set loud sound threshold %value",
"input.soundLevel|block": "sound level",
"input|block": "input",
"{id:category}Input": "Input",
"{id:group}More": "More"
}

14
libs/microphone/pxt.json Normal file
View File

@ -0,0 +1,14 @@
{
"additionalFilePath": "../../node_modules/pxt-common-packages/libs/microphone",
"files": [
"README.md",
"microphone.cpp",
"microphonehw.cpp",
"enums.d.ts",
"shims.d.ts"
],
"hidden": true,
"dependencies": {
"core": "file:../core"
}
}

33
libs/microphone/shims.d.ts vendored Normal file
View File

@ -0,0 +1,33 @@
// Auto-generated. Do not edit.
declare namespace input {
/**
* Registers an event that runs when a loud sound is detected
*/
//% help=input/on-loud-sound
//% blockId=input_on_loud_sound block="on loud sound"
//% parts="microphone"
//% weight=88 blockGap=12 shim=input::onLoudSound
function onLoudSound(handler: () => void): void;
/**
* Reads the loudness through the microphone from 0 (silent) to 255 (loud)
*/
//% help=input/sound-level
//% blockId=device_get_sound_level block="sound level"
//% parts="microphone"
//% weight=34 blockGap=8 shim=input::soundLevel
function soundLevel(): int32;
/**
* Sets the minimum threshold for a loud sound
*/
//% help=input/set-loud-sound-threshold
//% blockId=input_set_loud_sound_threshold block="set loud sound threshold %value"
//% parts="microphone"
//% value.min=1 value.max=255
//% group="More" weight=14 blockGap=8 shim=input::setLoudSoundThreshold
function setLoudSoundThreshold(value: int32): void;
}
// Auto-generated. Do not edit. Really.