#

介绍#

VEX IQ(第二代)大脑感应类别提供了与大脑按钮和连接电池交互的方法。

以下是所有可用方法的列表:

操作——与 VEX IQ(第二代)按钮交互。

  • pressed – Calls a function when the specified button is pressed.

  • released – Calls a function when the specified button is released.

Getters – 从按钮和电池返回数据。

  • capacity – Returns the remaining battery capacity as a percentage.

  • pressing – Returns whether the specified button is being pressed.

  • voltage – Returns the battery voltage in volts.

  • current – Returns the battery current in amps.

构造函数——手动初始化大脑。

  • brain – Create a Brain.

行动#

pressed#

pressed registers a function to be called when a specific button on the Brain is pressed. This method must be called on a specific button object, such as buttonCheck – (see full list of button objects below).

用法:
三个可用按钮对象之一可以与此方法一起使用,如下所示:

按钮

命令

buttonCheck

Brain.buttonCheck.pressed(callback); — The Check button

buttonLeft

Brain.buttonLeft.pressed(callback); — The Left button

buttonRight

Brain.buttonRight.pressed(callback); — The Right button

参数

描述

callback

先前定义的当按下指定按钮时执行的函数。

// Example coming soon

released#

released registers a function to be called when a specific button on the Brain is released. This method must be called on a specific button object, such as buttonCheck – (see full list of button objects below).

用法:
三个可用按钮对象之一可以与此方法一起使用,如下所示:

按钮

命令

buttonCheck

Brain.buttonCheck.released(callback); — The Check button

buttonLeft

Brain.buttonLeft.released(callback); — The Left button

buttonRight

Brain.buttonRight.released(callback); — The Right button

参数

描述

callback

先前定义的当按下指定按钮时执行的函数。

// Example coming soon

吸气剂#

capacity#

capacity returns the remaining battery capacity of the Brain as a percentage.

Usage:
Brain.Battery.capacity(units)

参数

描述

units

The unit that represents the capacity:

  • percent
// Example coming soon

pressing#

pressing returns a Boolean indicating whether a specific button on the Brain is currently being pressed. This method must be called on a specific button object, such as buttonCheck (see full list of button objects below).

  • 1 - The specified button is being pressed.

  • 0 - The specified button is not being pressed.

用法:
三个可用按钮对象之一可与此方法一起使用,如下所示:

按钮

命令

buttonCheck

Brain.buttonCheck.pressing() — The Check button

buttonLeft

Brain.buttonLeft.pressing() — The Left button

buttonRight

Brain.buttonRight.pressing() — The Right button

参数

描述

该方法没有参数。

// Example coming soon

voltage#

voltage returns the Brain’s battery voltage in volts.

Usage:
Brain.Battery.voltage()

参数

描述

该方法没有参数。

// Example coming soon

current#

current returns the Brain’s battery current in amps.

Usage:
Brain.Battery.current()

参数

描述

该方法没有参数。

// Example coming soon

构造函数#

brain#

brain creates an object of the brain Class.

Usage:
brain Brain;

范围

描述

此构造函数没有参数。

// Example coming soon