# vex-tutorials **Repository Path**: sn-yang/vex-tutorials ## Basic Information - **Project Name**: vex-tutorials - **Description**: No description available - **Primary Language**: Unknown - **License**: MIT - **Default Branch**: master - **Homepage**: None - **GVP Project**: No ## Statistics - **Stars**: 0 - **Forks**: 0 - **Created**: 2020-11-24 - **Last Updated**: 2020-12-19 ## Categories & Tags **Categories**: Uncategorized **Tags**: None ## README # VEX Code 教程 ## 介绍 VEX Code 是[VEX Robotics](https://www.vexrobotics.com/)公司提供的 VEX 集成软件开发工具。 提供编写代码、编译等功能。 本教程是针对 VEX Code Pro 版本,提供 C++的代码示例。 ## VEX Code 的版本 [官方说明](https://www.vexrobotics.com/vexcode-features) - VEXcode Go (Blocks) 网页版, 面向小学生提供的 VEX 软件开发工具,语言:Scratch - VEX Code IQ 语言: Scratch,C++, - VEX Code 语言: Scratch, Python - VEX Code Pro 语言: C++ - VEX Code VR 语言: Scratch,提供了 VR 可视化功能。[网页版](https://vr.vex-academy.com/) ## 下载 & 安装 [官方下载地址](https://www.vexrobotics.com/vexcode-download) 下载并安装`VEX Code Pro` ## 创建第一个工程 ### 步骤 - 选择 `File` > `New` - ![new project dialog](new-project-1.png) - 更改工程名称 - 点击`Create` ### 产生的文件 ![file list](new-project-file-list.png) - robot-confif.h ```c++ // vex sdk 命名空间 using namespace vex; // vex控制终端 extern brain Brain; /** * Used to initialize code/tasks/devices added using tools in VEXcode Pro. * * This should be called at the start of your int main function. */ void vexcodeInit(void); ``` - robot-config.cpp ```c++ #include "vex.h" using namespace vex; // A global instance of brain used for printing to the V5 brain screen brain Brain; /** * Used to initialize code/tasks/devices added using tools in VEXcode Pro. * * This should be called at the start of your int main function. */ void vexcodeInit(void) { // Nothing to initialize } ``` - vex.h ```c++ /*----------------------------------------------------------------------------*/ /* */ /* Module: vex.h */ /* Author: Vex Robotics */ /* Created: 1 Feb 2019 */ /* Description: Default header for V5 projects */ /* */ /*----------------------------------------------------------------------------*/ // #include #include #include #include #include "v5.h" #include "v5_vcs.h" #include "robot-config.h" #define waitUntil(condition) \ do { \ wait(5, msec); \ } while (!(condition)) #define repeat(iterations) \ for (int iterator = 0; iterator < iterations; iterator++) ``` - main.cpp ```c++ /*----------------------------------------------------------------------------*/ /* */ /* Module: main.cpp */ /* Author: C:\Users\player */ /* Created: Mon Nov 23 2020 */ /* Description: V5 project */ /* */ /*----------------------------------------------------------------------------*/ // ---- START VEXCODE CONFIGURED DEVICES ---- // ---- END VEXCODE CONFIGURED DEVICES ---- #include "vex.h" using namespace vex; int main() { // Initializing Robot Configuration. DO NOT REMOVE! vexcodeInit(); } ``` ### 其它的工程文件 - MyProject1.v5code 工程定义文件 - `makefile` C++工程的编译文件 - `vex/mkenv.mk` C++工程的编译文件 - `vex/mkrules.mk` C++工程的编译文件 - `compile_commands.json` C++工程的编译文件 ## VEX Code Pro 界面说明 ## VEX Code Pro 快捷键 ## VEX Code Pro SDK