Brain Sensing#

Introduction#

The Brain Sensing category includes blocks that detect input from the VEX IQ (2nd gen) Brain and report internal system values. These blocks allow your project to respond to button presses, monitor battery status, and determine the current screen cursor position when printing.

These blocks are often used in tandem with visual feedback tools such as the Screen or Console blocks, helping create interactive or responsive programs during runtime.

Below is a list of available blocks:

  • cursor column – Returns the current screen cursor’s column (1–80).

  • cursor row – Returns the current screen cursor’s row (1–9).

  • brain button pressed? – Returns a Boolean indicating whether a specific Brain button is currently pressed.

  • battery capacity – Returns the current battery level as a percentage.

cursor column#

The cursor column block returns the column number where text will be printed as an integer.

    (cursor column)

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    print (cursor column) on [Brain v]  ◀ and set cursor to next row

cursor row#

The cursor row block returns the row number where text will be printed as an integer.

    (cursor row)

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    print (cursor row) on [Brain v]  ◀ and set cursor to next row

brain button pressed?#

The brain button pressed? block returns if a specified Brain button is currently being pressed or not pressed. This block returns a Boolean value:

  • True - The specified button is being pressed.

  • False - The specified button is not being pressed

    <Brain [Left v] button pressed?>

Parameters

Description

button

The button to check for a press or release:

  • Left
  • Right
  • Check

Example

    when started :: hat events
    [Don't print the message until the right Brain Button is pressed]
    wait until <Brain [Right v] button pressed?>
    print [Right Brain button was pressed.] on [Brain v]  ◀ and set cursor to next row

battery capacity#

The battery capacity block returns the battery charge level as a percentage. This returns a number from 0 to 100.

    (battery capacity in %)

Parameters

Description

This block has no parameters.

Example

    when started :: hat events
    print (battery capacity in %) on [Brain v]  ◀ and set cursor to next row