磁铁#
介绍#
VEX GO 电磁铁可让您的机器人通过拾取和释放磁性物体来与它们进行交互。
For the examples below, the configured electromagnet will be named magnet. This name is used in all subsequent examples throughout this API documentation when referring to Magnet class methods.
Below is a list of all methods:
Actions — Enable or disable the electromagnet.
energize— sets the state of the electromagnet to either pick up or drop objects.
行动#
energize#
energize sets the state of the electromagnet to either pick up or drop objects.
Usage:
magnet.energize(action)
参数 |
描述 |
|---|---|
|
The state of the electromagnet to set:
|
# Build Used: Super Code Base 2.0
def main():
# Drop an attached Disk
drivetrain.drive_for(FORWARD, 200, MM)
magnet.energize(DROP)
drivetrain.drive_for(REVERSE, 200, MM)
# Start threads — Do not delete
start_thread(main)