Imán#
Introducción#
El imán V5 solo se utiliza con la celda de trabajo V5.
A continuación se muestra una lista de los métodos disponibles:
Acciones – Interactúa con el imán.
pickup– Activates the Magnet to pick up an object.drop– Deactivates the Magnet to drop an object.set_power– Sets the power level of the Magnet used to pickup and drop.
Getters: devuelven datos del Magnet.
temperature– Returns the temperature of the Magnet.installed– Checks if the Magnet is connected.timestamp– Returns the timestamp of the last received status packet from the Magnet.
Constructores: inicializan y configuran manualmente el Magnet.
Electromagnet– Create a magnet.
Comportamiento#
pickup#
pickup(duration, units, power) activates the Magnet to pick up an object.
Usage:
magnet.pickup(duration, units, power)
Parámetros |
Descripción |
|---|---|
|
Opcional. La duración para activar el imán como un entero o un valor flotante. |
|
Optional. Units for the duration:
|
|
Opcional. El nivel de potencia a configurar (0-100). |
# Set the Magnet to pickup.
magnet.pickup()
# Set the Magnet to pickup for 250 milliseconds at
# 90% power.
magnet.pickup(250, MSEC, 90)
drop#
drop() deactivates the Magnet to drop an object.
Usage:
magnet.drop(duration, units, power)
Parámetros |
Descripción |
|---|---|
|
Opcional. La duración para desactivar el imán como un entero o un valor flotante. |
|
Optional. Units for the duration:
|
|
Opcional. El nivel de potencia a configurar (0-100). |
# Set the Magnet to drop.
magnet.drop()
# Set the Magnet to drop for 250 milliseconds at
# 90% power.
magnet.drop(250, MSEC, 90)
set_power#
set_power(value) sets the power level of the Magnet used to pickup and drop.
Usage:
magnet.set_power(value)
Parámetros |
Descripción |
|---|---|
|
El nivel de potencia a configurar (0 - 100). |
# Set the default power to 80%.
magnet.set_power(80)
Captadores#
temperature#
temperature() returns the temperature of the Magnet as a float.
Usage:
magnet.temperature(units)
Parámetros |
Descripción |
|---|---|
|
Optional. Units for the temperature :
|
installed#
installed() returns a Boolean if the Magnet is connected.
True- The Magnet is connected to the Brain.False- The Magnet is not connected to the Brain.
Usage:
magnet.installed()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
timestamp#
timestamp() returns an integer as the timestamp of the last received status packet from the Magnet.
Usage:
magnet.timestamp()
Parámetros |
Descripción |
|---|---|
Este método no tiene parámetros. |
Constructores#
Los constructores se utilizan para crear manualmente objetos Magnet, que son necesarios para configurar un Magnet fuera de VEXcode.
Electromagnet#
Electromagnet crea un imán.
Uso: magnet_1 = Electromagnet(port)
Parámetro |
Descripción |
|---|---|
|
Which Smart Port that the magnet is connected to as |
# Create a Magnet in Port 1.
magnet_1 = Electromagnet(Ports.PORT1)