Διακόπτης ορίου#
Εισαγωγή#
Ο Διακόπτης ορίου είναι ένας μικρός ψηφιακός αισθητήρας που ανιχνεύει φυσική επαφή με ένα αντικείμενο.

This page uses limit_switch as the example Limit Switch name. Replace it with your own configured name as needed.
Παρακάτω είναι μια λίστα με τις διαθέσιμες μεθόδους:
pressing– Returns whether the specified Limit Switch is being pressed.pressed– Registers a function to be called whenever the Limit Switch is pressed.released– Registers a function to be called whenever the Limit Switch is released.
Constructor – Χειροκίνητη αρχικοποίηση ενός διακόπτη ορίου.
Limit– Create a Limit Switch.
πιεστικός#
pressing returns a Boolean indicating whether the Limit Switch is currently being pressed.
True– The Limit Switch is being pressed.False– The Limit Switch is not being pressed.
Usage:
limit_switch.pressing()
Παράμετροι |
Περιγραφή |
|---|---|
Αυτή η μέθοδος δεν έχει παραμέτρους. |
# Display a message after limit_switch is pressed
while not limit_switch.pressing():
pass
brain.screen.print("Limit Switch pressed!")
πιεσμένο#
pressed registers a function to be called whenever the Limit Switch is pressed.
Usage:
limit_switch.pressed(callback, arg)
Παράμετροι |
Περιγραφή |
|---|---|
|
Μια προηγουμένως καθορισμένη συνάρτηση που εκτελείται όταν πατηθεί ο διακόπτης ορίου. |
|
Optional. A |
def my_function():
brain.screen.print("Pressed")
# Call my_function whenever limit_switch is pressed
limit_switch.pressed(my_function)
κυκλοφόρησε#
released registers a function to be called whenever the Limit Switch is released.
Usage:
limit_switch.released(callback, arg)
Παράμετροι |
Περιγραφή |
|---|---|
|
Μια προηγουμένως καθορισμένη function που εκτελείται όταν απελευθερωθεί ο διακόπτης ορίου. |
|
Optional. A |
def my_function():
brain.screen.print("Pressed")
# Call my_function whenever limit_switch is released
limit_switch.released(my_function)
Κατασκευαστής#
Constructors are used to manually create Limit objects, which are necessary for configuring a Limit Switch outside of VEXcode.
Limit#
Limit creates a Limit Switch.
Usage:
Limit(port)
Παράμετρος |
Περιγραφή |
|---|---|
|
The 3-Wire Port that the Limit Switch is connected to:
|
# Create a Limit Switch in Port A
light_switch = Limit(brain.three_wire_port.a)