brain#

Initializing the brain Class#

The Brain is created by using the following constructor:

brain

This constructor uses no parameters.

// Create a new object "Brain" with the brain class.
brain Brain;

This Brain object will be used in all subsequent examples throughout this API documentation when referring to brain class methods and attributes.

The brain class comes with six pre-defined attributes:

  • Battery - Provides information about the V5 Brain’s battery, including capacity, temperature, voltage, and current.

  • Timer - Provides functionality to measure elapsed time and assign functions to time-based events on the V5 Brain.

  • Screen - Enables you to display text, draw shapes, and assign touch-responsive functions on the V5 Brain’s Screen.

  • SDcard - Provides access to files stored on the V5 Brain’s SD card.

  • ThreeWirePort - Provides access to 3-Wire Sensors connected to the V5 Brain’s 3-Wire Ports. Each port is identified by a letter (a through h) and can be accessed using the format brain.ThreeWirePort.X, where X is the port letter. For example, brain.ThreeWirePort.A refers to the Sensor connected to port A.

Attributes

Class Methods#

In addition to its attributes, the Brain class provides a method that can be used directly.

programStop()#

The programStop() method stops the currently running project.

Returns: None.