控制器#
初始化控制器类#
要在项目中使用控制器,请首先按如下方式初始化它:
# Create a new object "controller" with the Controller class.
controller = Controller()
This controller
object will be used in all subsequent examples throughout this API documentation when referring to Controller class methods and attributes.
The Controller class comes with three pre-defined attributes, though the screen
attribute is only available if you are using a V5 Controller:
类方法#
In addition to its attributes, the Controller has access to the rumble
method if using a V5 Controller.
控制器.rumble()#
The controller.rumble(pattern)
method sends a rumble string to the V5 controller.
范围 |
描述 |
---|---|
图案 |
一种使用“。”和“-”表示短隆隆声和长隆隆声的模式。 |
**返回:**无
# Rumble the V5 Controller to the pattern short-short-long-long.
controller.rumble('..--')