# 摇杆模块

## 概述

摇杆模块可以调节输出电压，其实就是一个摇杆电位计。利用这个可以做很多应用，比如四轴飞行器的遥控手柄等。摇杆电位计内部其实是两个电位计，定义成X、Y方向。上、下方向调节一个电位器的阻值，左、右方向调节另外一个电位器的阻值。当拨杆在没有动作时处在中间位置，也就是阻值的中间值，所以用串口输出电压值时，中间是512左右，两端是0\~1023。

## 参数

* 尺寸：48x24mm
* 工作电压：5V
* 接口类型：XH2.54mm-4P
* 引脚定义：1-地 2-电源 3-SCL 4-SDA

## 接口说明

* 可用端口：四排排针

## 使用方式

![](/files/-LWVPVs_MtHQLAEVjDRT)

## 示例代码

![](/files/-LWVPVsbk8owDn36H7M4)

![](/files/-LWVPVsdlIHXnIYW6OrX)

[摇杆模块示例代码](http://www.haohaodada.com/show.php?id=955811)

## 原理图

{% file src="/files/-LrD5f\_PgryxmPZk2sX9" %}
摇杆模块原理图
{% endfile %}

## 尺寸说明

![](/files/-LWVPVY3e-Jx5ZBpQh7a)

## 常见问题


---

# 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://docs.haohaodada.cn/jiao-xue-chan-pin/arduino-kai-yuan-ying-jian/yao-gan-mo-kuai.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.
