393號發動機#

介紹#

Motor 393 是一款直流電機,由 VEX 電機控制器 29 (MC29) 控制。 MC29 將來自 3 線 Brain 連接埠的脈衝寬度調變 (PWM) 訊號轉換為驅動 Motor 393 的可變電壓。

VEX馬達控制器29.

本頁使用 motor_393 作為範例馬達 393 的名稱。請根據需要將其替換為您自己配置的名稱。

以下是可用方法清單:

  • spin – 使馬達 393 正轉或反轉,直到停止。

  • set_velocity – 告訴馬達 393 旋轉的速度。

  • stop – 立即停止馬達 393。

  • set_reversed – 設定馬達 393 的方向反轉。

建構函式 - 手動初始化馬達控制器 29。

  • Motor29 – 建立馬達控制器 29。

旋轉#

spin 使用 目前馬達轉速 使連接的馬達 393 沿著指定方向旋轉。

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

參數

描述

direction

馬達 393 的旋轉方向:

  • FORWARD – 預設為逆時針
  • REVERSE – 預設為順時針

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

可選。速度單位:

  • PERCENT
  • RPM (預設)– 每分鐘轉數
  • VelocityUnits.DPS – 每秒度數

設定速度#

set_velocity 告訴馬達 393 的旋轉速度。百分比越高,馬達 393 的旋轉速度越快;百分比越低,馬達 393 的旋轉速度越慢。

每個項目開始時,每個馬達 393 預設以 50% 的速度旋轉。

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

可選。速度單位:

  • PERCENT
  • RPM (預設)– 每分鐘轉數
  • VelocityUnits.DPS – 每秒度數

停止#

stop 立即停止連接的馬達 393。

Usage:
motor_393.stop()

參數

描述

此方法沒有參數。

設定反轉#

set_reversed 將馬達 393 設定為反轉,以便 FORWARD 方向順時針旋轉。此方法與建構 Motor29 時將 reverse 參數設為 True 效果相同。

Usage:
motor_393.set_reversed(value)

參數

描述

value

馬達 393 的旋轉方向是否反轉:

  • True — 反轉馬達 393 的旋轉方向。 4
  • 假False 預設值

建構函數#

建構函數用於手動建立 Motor29 對象,這些對象對於在 VEXcode 之外配置馬達控制器 29/馬達 393 是必要的。

Motor29#

Motor29 創建馬達控制器 29。

Usage:
Motor29(port, reverse)

範圍

描述

port

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

  • On the EXP Brain – Ports.PORTx where x is the number of the port.
  • On a 3-Wire Expander – expander.a where expander is the name of the expander instance.

reverse

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

  • True – FORWARD 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)