磁铁#

介绍#

VEX GO 电磁铁可让您的机器人通过拾取和释放磁性物体来与它们进行交互。

For the examples below, the configured electromagnet will be named magnet. They will be used in all subsequent examples throughout this API documentation when referring to Magnet class methods.

以下是所有可用方法的列表:

操作——启用或禁用电磁铁。

  • energize – Sets the electromagnet to pick up or drop objects.

行动#

energize#

energize 设置电磁铁的状态,以便它可以拾取或放下物体。

Usage:
magnet.energize(action)

参数

描述

action

要设置

    磁铁状态:
    • BOOSTDROP
    • 禁用拾取物体并丢弃任何持有的物体。8
# Build Used: Super Code Base 2.0
def main():
    # Pick up an object along a path
    magnet.energize(BOOST)
    drivetrain.drive_for(FORWARD, 200, MM)

# Start threads — Do not delete
start_thread(main)