活动#

介绍#

An event is a starting signal for a set of blocks. Events blocks in VEXcode V5 let different sets of blocks begin at different times. For example, one set of blocks can start when the project begins, and another can start when a signal is sent from somewhere else in the project.

  • 启动时 – 项目启动时运行附加的堆栈代码块。

  • when autonomous – Runs the attached stack of blocks when the Brain receives an autonomous signal.

  • when driver control – Runs the attached stack of blocks when the Brain receives a driver control signal.

  • when I receive event – Runs the attached stack of blocks when a specific event is broadcast.

  • broadcast event – Triggers an event without pausing other blocks.

  • broadcast event and wait – Triggers an event and pauses other blocks until the event’s tasks complete.

开始时#

The when started hat block starts running the blocks below it when the project begins. Every project needs at least one when started block — without it, the blocks below it will not run. Multiple when started blocks can be used to run different sets of blocks at the same time.

开始帽子模块。#
当开始

参数

描述

此代码块没有参数。

例子

当开始
[Turn around at the start of the project.]
归位至 [180] 度 ▶

自主#

The when autonomous hat block runs the attached stack of blocks when the Brain receives an autonomous signal.

此模块仅用于竞赛项目。

开始帽子模块。#
当自控 :: hat events

参数

描述

此代码块没有参数。

当驾驶员控制时#

The when driver control hat block runs the attached stack of blocks when the Brain receives a driver control signal.

此模块仅用于竞赛项目。

开始帽子模块。#
when drive control :: hat events

参数

描述

此代码块没有参数。

当我收到事件时#

The when I receive event hat block starts running the blocks below it when a signal with the same event name is broadcast.

当我收到事件帽子块时。#
当我收到 [my_event v]

参数

描述

事件

要触发的事件。用户可以选择现有事件、创建新事件、重命名所选事件或删除事件。

例子

当开始
[Display a message and turn at the same time when the screen is pressed.]
等到 <屏幕按下了?>
广播 [turn v]
当我收到 [turn v]
在屏幕上打印 [Received!]▶
[右 v] 转 [90] 度 ▶

直播活动#

The broadcast event stack block sends a signal that starts any when I receive event block with the same event name. The rest of the blocks in the project keep running without waiting for those blocks to finish.

广播事件堆栈块。#
广播 [message1 v]

参数

描述

事件

要触发的事件。用户可以选择现有事件、创建新事件、重命名所选事件或删除事件。

例子

当开始
[Turn left when the screen is pressed.]
永久循环
如果 <屏幕按下了?> 那么
广播 [screen_press v]
否则
[右 v] 转
当我收到 [screen_press v]
[左 v] 转

直播活动并等待#

The broadcast event and wait stack block sends a signal that starts any when I receive event block with the same event name. The rest of the project will wait for the broadcasted event to finish running.

广播事件和等待栈块。#
广播 [message1 v] 并等待

参数

描述

事件

要触发的事件。用户可以选择现有事件、创建新事件、重命名所选事件或删除事件。

例子

当开始
[Move after the Brain's screen is pressed.]
等到 <屏幕按下了?>
广播 [forward_and_turn v] 并等待
在屏幕上打印 [Movement done.]▶
当我收到 [forward_and_turn v]
驱动 [向前 v] [100] [毫米 v] ▶
[右 v] 转 [90] 度 ▶