脑#
初始化 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
- 提供有关 V5 Brain 电池的信息,包括容量、温度、电压和电流。timer
- 提供测量经过时间的功能并为 V5 Brain 上基于时间的事件分配功能。screen
- 使您能够在 V5 Brain 的屏幕上显示文本、绘制形状和分配触摸响应功能。sdcard
- 提供对存储在 V5 Brain 的 SD 卡上的文件的访问。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.
类方法#
除了属性之外,Brain 类还提供了可以直接使用的方法。
program_stop()#
The program_stop()
method stops the currently running project.
**返回:**无。