> For the complete documentation index, see [llms.txt](https://sharinghub.kittenbot.hk/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://sharinghub.kittenbot.hk/mcu/meowbit/coding/meowbit_light.md).

# MeowBit的光度感應器

Meowbit上搭載了光度感應器，可以探測光度數值和判斷環境為黑暗或明亮。

### MakeCode Arcade編程教學

![](https://kittenbothk.readthedocs.io/en/latest/_images/acbanner2.png)

#### 載入控制器插件

#### [詳細方法](/programmingplatforms/makecode/kittenbotandmakecode.md)

![](https://kittenbothk.readthedocs.io/en/latest/_images/sd5.png)

![](https://kittenbothk.readthedocs.io/en/latest/_images/light12.png)

#### 控制器積木塊

![](https://kittenbothk.readthedocs.io/en/latest/_images/light22.png)

#### 光度感應編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/light32.png)

當我們遮擋著Meowbit的光度感應器的時候，小鴨會說出”很暗”，用電筒照射它時說出”很光”。

[參考程式](https://makecode.com/_EUyfs590PdhJ)

#### 探測光度數值編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/light4.png)

```
光度數值範圍由0-255
```

小鴨會一直說出現時的光度數值。

[參考程式](https://makecode.com/_VbYeA6apKPd0)

### Kittenblock編程教學

![](https://kittenbothk.readthedocs.io/en/latest/_images/kbbanner11.png)

#### 探測光度數值編程

![](https://kittenbothk.readthedocs.io/en/latest/_images/light5.png)

小貓會一直說出現時的光度數值。
