伺服电机#

介绍#

VEX 三线伺服电机 是一款三线设备,可以根据 V5 控制器的控制信号旋转到特定位置。

EDR VEX伺服电机

This page uses servo_motor as the example Servo Motor name. Replace it with your own configured name as needed.

以下是可用方法列表:

  • set_position – Rotates a Servo Motor to a specified angle between 0 and 100 degrees.

构造函数 - 手动初始化伺服电机。

  • Servo – Creates a Servo Motor.

设置位置#

set_position rotates a Servo Motor to a specified angle between 0 and 100 degrees.

**注意:**伺服电机在开始每个项目之前,都会自动将自身居中于 50 度,然后再进行任何运动。

伺服电机示意图,显示其旋转角度,从 100 度到 0 度。

Usage:
servo_motor.set_position(value, units)

参数

描述

value

伺服电机旋转到的位置,可以是浮点数或整数。

units

The unit that represents the positional value:

  • DEGREES
  • PERCENT (default)

构造函数#

Constructors are used to manually create Servo objects, which are necessary for configuring a Servo Motor outside of VEXcode.

Servo#

Servo creates a Servo Motor.

Usage:
Servo(port, gears, reverse)

范围

描述

port

The 3-Wire Port that the V5 Pneumatic Solenoid is connected to:

  • On the V5 BrainPorts.PORTx where x is the number of the port.
  • On a 3-Wire Expanderexpander.a where expander is the name of the expander instance.

# Create a Servo Motor in Port A
servo_motor = Servo(brain.three_wire_port.a)