脑#
初始化 Brain 类#
要在您的项目中使用 V5 Brain,请首先按如下方式初始化它:
# 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.
Brain 类具有五个预定义属性:
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, wherexis the port letter. For example,brain.three_wire_port.arefers to the Sensor connected to port A.
类方法#
除了属性之外,Brain 类还提供了可以直接使用的方法。
program_stop()#
The program_stop() method stops the currently running project.
**返回:**无。