維克多汽車#
介紹#
VEX Victor 馬達控制器 是一款傳統的馬達控制器,它接收來自主機的 3 線 PWM 訊號來控制無法直接插入智慧型連接埠的 VEXpro/EDR 直流馬達。
本頁使用 victor_motor 作為 Victor 馬達控制器的範例名稱。請根據需要將其替換為您自己配置的名稱。
以下是可用方法清單:
spin– 使馬達正轉或反轉,直到停止。stop– 立即停止馬達。set_velocity– 告訴馬達旋轉的速度。set_reversed– 設定馬達反轉其旋轉方向。
建構子 – 手動初始化 Victor 馬達控制器。
MotorVictor– 建立一個 Victor 馬達控制器。
旋轉#
spin 使用 目前馬達轉速 使連接的馬達沿指定方向旋轉。
Usage:
victor_motor.spin(direction, velocity, units)
參數 |
描述 |
|---|---|
|
馬達旋轉方向:
|
|
Optional. The velocity to spin with from 0% to 100% when using |
|
可選。速度單位:
|
停止#
stop 立即停止連接的馬達。
Usage:
victor_motor.stop()
參數 |
描述 |
|---|---|
此方法沒有參數。 |
設定速度#
set_velocity 告訴馬達旋轉的速度。百分比越高,馬達旋轉速度越快;百分比越低,馬達旋轉速度越慢。
每個項目開始時,每個連接的馬達預設以 50% 的速度旋轉。
Usage:
victor_motor.set_velocity(value, units)
範圍 |
描述 |
|---|---|
|
The velocity to spin with from 0% to 100% when using |
|
可選。速度單位:
|
set_reversed#
set_reversed 將馬達反轉,使 FORWARD 方向順時針旋轉。此方法與建構 MotorVictor 時將 reverse 參數設為 True 效果相同。
Usage:
victor_motor.set_reversed(value)
參數 |
描述 |
|---|---|
|
馬達方向是否反轉:
|
建構函數#
建構函式用於建立 MotorVictor 對象,這些物件是配置 Victor 馬達控制器所必需的。
MotorVictor#
MotorVictor 創建一個 Victor 馬達控制器。
Usage:
MotorVictor(port, reverse)
範圍 |
描述 |
|---|---|
|
The 3-Wire Port that the Victor Motor Controller is connected to:
|
|
Optional. Sets whether the motor’s spin should be reversed.
|
# Create a Victor Motor Controller in Port A
victor_motor = MotorVictor(brain.three_wire_port.a)