
Get current light level, we divide the light intensity into 5 levels,from 1 to 5.which 1
represents brightest and 5 represents darkness.
function LightSensorGetLevel(connName: AnalogConnName): number;
Parameters
•
connName
is the analog connector's name.this module can only be pluged into
analog connector A0,A1 and A2.
Light Sensor event
配置
MCU
定期檢查光級別,然後在光級別更改時執行相關的代碼塊。
Configure the MCU check the light level periodically, and then execute the associated
code block whenever the light level changes.
function onLightSensorEvent(connName: AnalogConnName, body: () => voi
d): 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 light level
此示例顯示如何獲取當前的燈光級別,並將其顯示在
LED
屏幕上。
This example show you how to get the current light level,and show it on the LED
screen.