VEXcode Pro V5 で前後に進むためのプロジェクトの作成

The VEX Visual Studio Code Extension has replaced VEXcode Pro V5, which is now end-of-life.

VEXcode Blocks and VEXcode Text remain actively developed and supported for all VEX platforms.

このプログラムは、VEXcode Pro V5 を使用して V5 Clawbot を前後に移動するようにプログラムする方法を示します。

main.cpp
// ---- VEXCODE 設定済みデバイスの開始 ----
// ロボット構成:
// [名前] [タイプ] [ポート]
// ドライブトレイン drivetrain 1、10、D
// クローモーター motor 3
// アームモーター motor 8
// ---- VEXCODE 設定済みデバイス終了 ----

#include "vex.h"

using namespace vex;
int main() {
  // ロボット構成の初期化。取り外さないでください!
  vexcodeInit();

  // 300ミリメートル前進します。
  Drivetrain.driveFor(300, mm);

  // 300ミリメートル逆方向に駆動します。
  Drivetrain.driveFor(-300, mm);
}
使い方

このプログラムは、 driveFor( distance, Units) コマンドを使用して、指定された距離を走行します。

数値を使用して距離の単位を指定できます。単位は インチ または mm (ミリメートル) を使用して指定できます。

ロボットを前進させるには正の数値を使用し、ロボットを後進させるには負の数値を使用できます。

プログラム内で実行されるステップ:

  1. ドライブトレインは 6 インチ前方に駆動します。 
  2. プログラムは、コードの次の行を実行する前に 1 秒待機します。
  3. ドライブトレインは 6 インチ後進します。

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: