Μαγνήτης#
Εισαγωγή#
Ο μαγνήτης V5 χρησιμοποιείται μόνο με το V5 Workcell.
Παρακάτω είναι μια λίστα με τις διαθέσιμες μεθόδους:
Ενέργειες – Αλληλεπίδραση με τον μαγνήτη.
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 – Επιστρέφουν δεδομένα από τον μαγνήτη.
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.
Κατασκευαστές – Μη αυτόματη αρχικοποίηση και ρύθμιση παραμέτρων του μαγνήτη.
Electromagnet– Create a magnet.
Ενέργειες#
pickup#
pickup(duration, units, power) activates the Magnet to pick up an object.
Usage:
magnet.pickup(duration, units, power)
Παράμετροι |
Περιγραφή |
|---|---|
|
Προαιρετικό. Η διάρκεια ενεργοποίησης του μαγνήτη ως ακέραιος αριθμός ή αριθμός κινητής υποδιαστολής. |
|
Optional. Units for the duration:
|
|
Προαιρετικά. Το επίπεδο ισχύος που θα οριστεί (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)
Παράμετροι |
Περιγραφή |
|---|---|
|
Προαιρετικό. Η διάρκεια απενεργοποίησης του μαγνήτη ως ακέραιος αριθμός ή αριθμός κινητής υποδιαστολής. |
|
Optional. Units for the duration:
|
|
Προαιρετικά. Το επίπεδο ισχύος που θα οριστεί (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)
Παράμετροι |
Περιγραφή |
|---|---|
|
Το επίπεδο ισχύος που θα οριστεί (0 - 100). |
# Set the default power to 80%.
magnet.set_power(80)
Αποκτητές#
temperature#
temperature() returns the temperature of the Magnet as a float.
Usage:
magnet.temperature(units)
Παράμετροι |
Περιγραφή |
|---|---|
|
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()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
timestamp#
timestamp() returns an integer as the timestamp of the last received status packet from the Magnet.
Usage:
magnet.timestamp()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
Κατασκευαστές#
Οι κατασκευαστές χρησιμοποιούνται για τη χειροκίνητη δημιουργία αντικειμένων Magnet, τα οποία είναι απαραίτητα για τη διαμόρφωση ενός Magnet εκτός του VEXcode.
Electromagnet#
Ο «ηλεκτρομαγνήτης» δημιουργεί έναν μαγνήτη.
Χρήση: magnet_1 = Ηλεκτρομαγνήτης(θύρα)
Παράμετρος |
Περιγραφή |
|---|---|
|
Which Smart Port that the magnet is connected to as |
# Create a Magnet in Port 1.
magnet_1 = Electromagnet(Ports.PORT1)