> For the complete documentation index, see [llms.txt](https://fliprobot.gitbook.io/knowledge-base/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://fliprobot.gitbook.io/knowledge-base/sensory-system-of-fliprobot-sensor-modules/light-sensor.md).

# 光線感應器

## 什麼是光線感應器 <a href="#what-is-light-sensor" id="what-is-light-sensor"></a>

![](/files/-LylI1bzPHlMc1QqbcOZ)

光線感應器可以偵測光線的強弱。其原理如同眼睛的瞳孔會感應到外界亮度過高、過低，根據感應結果進行反應(瞳孔縮小、放大)以適應當下環境。光線感應器裡面有一個光敏元件，會將接收到的光，轉換成電信訊號。光敏元件其實是利用接收到的光的強弱來改變電阻值，所以流經的電流大小會有所改變，藉此來輸出不同的電信訊號或做相關判斷。

FlipRobot的光線感應器接收光的數值範圍為0\~1023。

## 光線感應器的應用 <a href="#applications-of-light-sensor" id="applications-of-light-sensor"></a>

下面的程式範例將實作光線感應器的感測。

如下圖，如果光線感應器偵測的數值(透過下圖中藍色程式積木可以得到回饋的數值)大於等於10(一定的亮度)的條件成立時，執行前進的功能，否則執行停止的功能(表示光線感應器偵測的數值小於10)。

![](/files/-LRowqcQfQEyHRFnZaan)


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://fliprobot.gitbook.io/knowledge-base/sensory-system-of-fliprobot-sensor-modules/light-sensor.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
