393号发动机#

介绍#

Motor 393 是一款直流电机,由 VEX 电机控制器 29 (MC29) 控制。MC29 将来自 3 线 Brain 端口的脉冲宽度调制 (PWM) 信号转换为驱动 Motor 393 的可变电压。

VEX电机控制器29.

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

以下是可用方法列表:

  • spin – Spins a Motor 393 forward or reverse until stopped.

  • set_velocity – Tells a Motor 393 how fast to spin.

  • stop – Stops a Motor 393 immediately.

  • set_reversed – Sets a Motor 393 to have its direction be reversed.

构造函数 - 手动初始化电机控制器 29。

  • Motor29 – Creates a Motor Controller 29.

旋转#

spin rotates a connected Motor 393 in a specified direction using the current motor velocity.

Usage:
motor_393.spin(direction, velocity, units)

参数

描述

direction

The direction in which to spin the Motor 393:

  • FORWARD – By default, this is counterclockwise
  • REVERSE – By default, this is clockwise

velocity

Optional. The velocity to spin with from 0% to 100% when using PERCENT. This can be an integer or decimal (float). If the velocity is not specified or previously set, the default velocity is 50%.

units

Optional. The velocity unit:

  • PERCENT
  • RPM (default) – Rotations per minute
  • VelocityUnits.DPS – Degrees per second

设置速度#

set_velocity tells a Motor 393 how fast to spin. A higher percentage makes the Motor 393 spin faster and a lower percentage makes the Motor 393 spin slower.

Every project begins with each Motor 393 spinning at 50% velocity by default.

Usage:
motor_393.set_velocity(value, units)

范围

描述

velocity

The velocity to spin with from 0% to 100% when using PERCENT. This can be an integer or decimal (float).

units

Optional. The velocity unit:

  • PERCENT
  • RPM (default) – Rotations per minute
  • VelocityUnits.DPS – Degrees per second

停止#

stop stops the connected Motor 393 immediately.

Usage:
motor_393.stop()

参数

描述

此方法没有参数。

设置反转#

set_reversed sets the Motor 393 to be reversed so that the FORWARD direction will spin clockwise. This method works the same as setting the reverse parameter to True when constructing a Motor29.

Usage:
motor_393.set_reversed(value)

参数

描述

value

Whether the Motor 393’s direction is reversed:

  • True — Reverses the Motor 393’s direction.
  • False — Returns the Motor 393’s direction to its default.

构造函数#

Constructors are used to manually create Motor29 objects, which are necessary for configuring a Motor Controller 29/Motor 393 outside of VEXcode.

Motor29#

Motor29 creates a Motor Controller 29.

Usage:
Motor29(port, reverse)

范围

描述

port

The 3-Wire Port that the motor is connected to:

  • On the EXP 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.

reverse

Optional. Sets whether the Motor 393’s spin should be reversed.

  • TrueFORWARD will spin clockwise
  • False (default) – FORWARD will spin counterclockwise

# Create a Motor Controller 29 in Port A
motor_393 = Motor29(brain.three_wire_port.a)