轴#
位置()#
controller.axis.position()
命令以百分比形式返回指定控制器轴的当前位置。
目的 |
描述 |
---|---|
|
报告哪个轴的位置:
|
返回: +/- 100 范围内的值。
# Print the position of the current Controller's axis to the
# Brain's screen.
brain.screen.print(controller.axis1.position())
已更改()#
controller.axis.changed(callback, arg)
命令注册一个函数,当指定轴的值发生变化时调用该函数。
目的 |
描述 |
---|---|
|
报告哪个轴的位置:
|
范围 |
描述 |
---|---|
打回来 |
当轴值改变时调用的函数 |
arg |
**可选。**用于将参数传递给回调函数的元组 |
**返回:**事件类的一个实例。
# Define a function axis_changed().
def axis_changed():
# The Brain will print that the axis changed on the
# Brain's screen.
brain.screen.print("axis changed")
# Run axis_changed() when the value of axis1 changes.
controller.axis1.changed(axis_changed)