Electroimán#
Inicializando la clase de electroimán#
Un electroimán se crea utilizando el siguiente constructor:
Electromagnet(port)
Este constructor utiliza un parámetro:
Parámetro |
Descripción |
---|---|
|
Un Puerto inteligente válido al que está conectado el electroimán. |
# Construct an Electromagnet "magnet" with the
# Electromagnet class.
magnet = Electromagnet(Ports.PORT1)
This magnet
object will be used in all subsequent examples throughout this API documentation when referring to Electromagnet class methods.
Métodos de clase#
set_power()#
The set_power(value)
method sets the power level of the Electromagnet used to pickup and drop.
Parámetros |
Descripción |
---|---|
valor |
El nivel de potencia a configurar (0 - 100). |
Devoluciones: Ninguna.
# Set the default power to 80%.
magnet.set_power(80)
pickup()#
The pickup(duration, units, power)
method activates the Electromagnet to pick up an object.
Parámetros |
Descripción |
---|---|
duración |
Opcional. La duración para activar el electroimán. |
unidades |
Optional. A valid TimeUnits type. The default is |
fuerza |
Opcional. El nivel de potencia a configurar (0 - 100). |
Devoluciones: Ninguna.
# Set the Electromagnet to pickup.
magnet.pickup()
# Set the Electromagnet to pickup for 250 milliseconds at
# 90% power.
magnet.pickup(250, MSEC, 90)
drop()#
The drop()
method deactivates the Electromagnet to drop an object.
Parámetros |
Descripción |
---|---|
duración |
Opcional. La duración para desactivar el electroimán. |
unidades |
Optional. A valid TimeUnits type. The default is |
fuerza |
Opcional. El nivel de potencia a configurar (0 - 100). |
Devoluciones: Ninguna.
# Set the Electromagnet to drop.
magnet.drop()
# Set the Electromagnet to drop for 250 milliseconds at
# 90% power.
magnet.drop(250, MSEC, 90)
temperature()#
The temperature()
method returns the temperature of the Electromagnet.
Parámetros |
Descripción |
---|---|
unidades |
Optional. A valid TemperatureUnits type. The default is |
Devuelve: La temperatura del electroimán.
installed()#
The installed()
method checks if the Electromagnet is connected.
Returns: True
if the Electromagnet is installed. False
if it is not.
timestamp()#
The timestamp()
method returns the timestamp of the last received status packet from the Electromagnet.
Devuelve: La marca de tiempo del último paquete de estado recibido en milisegundos.