
Block API
Get sound level
獲取當前聲級,我們將聲音分為
5
級,範圍從
1
到
5.
其中
1
表示安靜,
5
表示噪
聲。
Get current sound level, we divide the sound into 5 levels, range from 1 to 5.which 1
represent quiet and 5 represent noisy.
function MICGetLevel(connName: AnalogConnName): number;
Parameters
•
connName
is the analog connector's name.this module can only be pluged into
analog connector A0,A1 and A2.
Sound Sensor event
配置
mcu
定期檢查聲級,然後每當聲級變化時執行相關的代碼塊。
Configure the mcu check the sound level periodically, and then execute the
associated code block whenever the sound level change.
function onMICEvent(connName: AnalogConnName, body: () => void): void;
Parameters
•
connName
is the analog connector's name.this module can only be pluged into
analog connector A0,A1 and A2.
Example
Show the sound level
此示例顯示如何獲取當前聲級,並在
LED
屏幕上顯示電平。
This example show you how to get the current sound level, and show the level
number on the LED screen.