Venture of Robots

VEX机器人角度传感器使用编程说明-How to use a potentiometer of VEX Robotics.

 

角度传感器是一类常见的传感器,它可以读取中心的轴与它标准位之间的角度,范围0~270度。

Potentiometer is a widely used analog sensors. It can read the degrees of the deflection angle between its centre and the shaft.The maximum degree it can read is 270 degrees.


在RobotC的编程语言中, 角度传感器没有特殊的函数未知对象,可以直接用SensorValue() 函数读取它的值。

In the language of RobotC, potentiometer doesn’t have any speacial fuction of it. We can read its value by using the fuction “SensorValue()”.


返回值数据范围:0-4095.最小和最大值分别在角度传感器的两个极端达到,各个角度传感器的返回值可能因各种原因而稍有差别。

Data Range:

0 to 4095. Minimum and maximum values are achieved at opposite ends of travel of the potentiometer and may vary slightly from one potentiometer to another.


注意:角度传感器的线应接在主控盒上的Analog口上。

Notice: It’s wire should be plugged into the Analog port on the Cortex.


1> Configurate a potentiometer sensor. 配置一个角度传感器

Click “Motor and Sensor Setup”.

点击Motor and Sensor Setup

选择  VEX 2.0 Analog Sensors 1-8.

Choose “VEX 2.0 Analog Sensors 1-8”.

Click ” SensorType “, choose “potentiometer”. Then name the Sensor.Click “Apply”.

点击 ” SensorType “, 选择 “potentiometer”.  接着重命名这个传感器。点击应用。

Then  it’s done!

配置好啦!


2> 读取一个传感器的值

Read the value of a Sensor

或者/ or

code is given below:

 

 

With the value that we read, we can accomplish many more things. Try it yourself and try more interesing ways of using it.

有了读取到的值后,我们可以用它来实现很多功能。 自己写写试试并探索更多有趣的用法吧!

作者/Author :Alpar.

This post is orginal, please remember to mark the source if you want to transfer the content.

这篇文章为原创,转载请标明出处。

 

Leave a Reply

Your email address will not be published. Required fields are marked *