大脑感知#

介绍#

Brain Sensing 类别包含可检测 VEX IQ(第二代)Brain 输入并报告内部系统值的模块。这些模块可让您的项目响应按钮按下、监控电池状态,并在打印时确定当前屏幕光标位置。

这些块通常与视觉反馈工具(例如屏幕或控制台块)一起使用,帮助在运行时创建交互式或响应式程序。

以下是可用块的列表:

大脑按钮被按下了吗?#

**“大脑按钮是否被按下?”块返回指定的“大脑按钮”当前是否被按下。此块返回一个布尔值:

  • True — 指定的按钮被按下。

  • False - 指定的按钮未被按下

<Brain [Left v] 键按下了?>

参数

描述

按钮

检查按下或释放的按钮:

  • 检查

例子

当开始 :: hat events
[Spin when a Brain button is pressed.]
等到 <Brain [Right v] 键按下了?>
[右 v] 转 (360) 度 ▶

电池容量#

电池容量 模块以百分比形式返回电池电量。它会返回一个 0 到 100 之间的数字。

(电池电量百分比)

参数

描述

该块没有参数。

例子

当开始 :: hat events
[Display the current battery capacity.]
在屏幕上打印 (电池电量百分比)◀ 并设定光标为下一行

when Brain button#

The when Brain button block runs the attached stack of blocks when the selected Brain button is pressed or released.

When brain button event hat block#
when Brain [left v] button [pressed v] :: hat events

参数

描述

buttons

Determines which button will trigger the event:

  • left
  • right
  • Check

action

Determines when the attached stack of blocks will execute:

  • pressed
  • released

例子

When the screen is pressed, the brain displays a text.#
when Brain [left v] button [pressed v] :: hat events
[Display a text when the left button is pressed.]
在屏幕上打印 [Hello, IQ!]◀ 并设定光标为下一行