# 旋轉可變電阻

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fcavedu%2F-LwWyONY0SnQRXIxBYtd%2F-LwX0p4g55j1t-Xg2QDK%2F0.png?generation=1576823903241212\&alt=media)

## 專案說明

使用「科易KEYES Arduino UNO R3 開發板」連接「旋轉可變電阻」,讀取旋轉可變電阻數值變化。

此**旋轉可變電阻**包含&#x65BC;**「**[洞洞兩教學材料包 Education Kit 002](https://www.robotkingdom.com.tw/product/rk-education-kit-002/)**」**&#x5167;。

## KEYES Arduino UNO R3電路圖

* [KEYES Arduino UNO R3](https://www.robotkingdom.com.tw/product/keyes-uno-r3/)
* 通用型彩色Sensor shield v5.0感測器擴充板
* 旋轉可變電阻

**旋轉可變電阻**是**類比訊號輸入**，可以接「A0 \~ A5」的KEYES Arduino UNO R3訊號端上。 本範例連接到「**A0」**

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fcavedu%2F-LwWyONY0SnQRXIxBYtd%2F-LwX0p4hy9qCA6LSNRIV%2F1.png?generation=1576823903287485\&alt=media)

## Arduino 程式

每0.5秒鐘會讀取旋轉可變電阻的電位一次， 並顯示在序列埠監控視窗上。

![](https://1275793585-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Fcavedu%2F-LwWyONY0SnQRXIxBYtd%2F-LwX0p4iREp5ayDGfaQa%2F2.png?generation=1576823903170891\&alt=media)

產生出的 Arduino 程式如下

```c
void setup()
{
 Serial.begin(9600);
}
void loop()
{
 Serial.println(analogRead(A0));
 delay(500);
}
```


---

# Agent Instructions: 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://cavedu.gitbook.io/cavedu/rk002/module/002_rotary_variable_resistor.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.
