Eventos#
Introducción#
An event is a starting signal for a set of blocks. Events blocks in VEXcode GO 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.
A continuación se muestra una lista de todos los bloques:
when started — Runs the attached stack of blocks when the project starts.
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.
cuando empezó#
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.
cuando empezó
Parámetros |
Descripción |
|---|---|
Este bloque no tiene parámetros. |
Ejemplo
cuando empezó :: hat events
[Build Used: Code Base 2.0]
[Drive forward then stop.]
unidad [adelante v]
esperar (2) segundos
deja de conducir
cuando recibo un evento#
The when I receive event hat block starts running the blocks below it when a signal with the same event name is broadcast.
cuando recibo [my_event v]
Parámetros |
Descripción |
|---|---|
evento |
El evento que se activará. Los usuarios pueden seleccionar un evento existente, crear uno nuevo, renombrarlo o eliminarlo. |
Ejemplo
cuando empezó :: hat events
[Build Used: Super Code Base 2.0]
[Turn LED Bumper green while the robot moves.]
transmisión [square_drive v]
establecer de [bumper v] a [verde v]
cuando recibo [square_drive v] :: hat events
[Move in a square pattern.]
repetir [4]
unidad [adelante v] para [100] [mm v] ▶
girar [derecha v] por [90] grado ▶
evento de transmisión#
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.
transmisión [message1 v]
Parámetros |
Descripción |
|---|---|
evento |
El evento que se activará. Los usuarios pueden seleccionar un evento existente, crear uno nuevo, renombrarlo o eliminarlo. |
Ejemplo
cuando empezó :: hat events
[Build Used: Super Code Base 2.0]
[Turn LED Bumper green while the robot moves.]
transmisión [square_drive v]
establecer de [bumper v] a [verde v]
cuando recibo [square_drive v] :: hat events
[Move in a square pattern.]
repetir [4]
unidad [adelante v] para [100] [mm v] ▶
girar [derecha v] por [90] grado ▶
evento de transmisión y espera#
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.
transmitir [message1 v] y esperar
Parámetros |
Descripción |
|---|---|
evento |
El evento que se activará. Los usuarios pueden seleccionar un evento existente, crear uno nuevo, renombrarlo o eliminarlo. |
Ejemplo
cuando empezó :: hat events
[Build Used: Super Code Base 2.0]
[Turn LED Bumper green after robot is done moving.]
transmitir [square_drive v] y esperar
establecer de [bumper v] a [verde v]
cuando recibo [square_drive v] :: hat events
[Move in a square pattern.]
repetir [4]
unidad [adelante v] para [100] [mm v] ▶
girar [derecha v] por [90] grado ▶