Brain#
Initializing the Brain Class#
To use the V5 Brain in your project, start by initializing it as follows:
# 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 five 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.three_wire_port
- 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 formatbrain.three_wire_port.x
, wherex
is the port letter. For example,brain.three_wire_port.a
refers to the Sensor connected to port A.
Class Methods#
In addition to its attributes, the Brain class provides a method that can be used directly.
program_stop()#
The program_stop()
method stops the currently running project.
Returns: None.