مفتاح الحد#
مقدمة#
مفتاح الحد هو مستشعر رقمي صغير يكشف التلامس المادي مع جسم ما.

تستخدم هذه الصفحة الاسم limit_switch كمثال لاسم مفتاح الحد. استبدله بالاسم الذي قمت بتكوينه حسب الحاجة.
فيما يلي قائمة بالطرق المتاحة:
pressing– إرجاع ما إذا كان يتم الضغط على مفتاح الحد المحدد.pressed– يسجل وظيفة ليتم استدعاؤها كلما تم الضغط على مفتاح الحد.released– يسجل وظيفة ليتم استدعاؤها كلما تم تحرير مفتاح الحد.
المنشئ – تهيئة مفتاح الحد يدويًا.
Limit– إنشاء مفتاح حد.
الضغط#
pressing returns a Boolean indicating whether the Limit Switch is currently being pressed. This can be used to check if the robot bumps into other objects.
True– يتم الضغط على مفتاح الحد.False– لم يتم الضغط على مفتاح الحد.
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)
حدود |
وصف |
|---|---|
|
A previously defined function that executes when the Limit Switch is pressed. |
|
اختياري. مجموعة |
def my_function():
brain.screen.print("Pressed")
# Call my_function whenever limit_switch is pressed
limit_switch.pressed(my_function)
مطلق سراحه#
released يسجل وظيفة ليتم استدعاؤها كلما تم تحرير مفتاح الحد.
Usage:
limit_switch.released(callback, arg)
حدود |
وصف |
|---|---|
|
A previously defined function that executes when the Limit Switch is released. |
|
اختياري. مجموعة |
def my_function():
brain.screen.print("Pressed")
# Call my_function whenever limit_switch is released
limit_switch.released(my_function)
المُنشئ#
تُستخدم الدوال البانية لإنشاء كائنات Limit يدويًا، وهي ضرورية لتكوين مفتاح الحد خارج VEXcode.
Limit#
Limit يُنشئ مفتاح حد.
Usage:
Limit(port)
المعلمة |
وصف |
|---|---|
|
المنفذ ثلاثي الأسلاك المتصل به مفتاح الحد:
|
# Create a Limit Switch in Port A
light_switch = Limit(brain.three_wire_port.a)