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

This page uses light_sensor as the example Light Sensor name. Replace it with your own configured name as needed.
Παρακάτω είναι μια λίστα με τις διαθέσιμες μεθόδους:
brightness– Returns the amount of light detected by the Light Sensor as a percent.changed– Registers a function to be called whenever the Light Sensor’s brightness value changes.
Constructor – Χειροκίνητη αρχικοποίηση ενός αισθητήρα φωτός.
Light– Create a Light Sensor.
λάμψη#
brightness returns the amount of light detected by the Light Sensor as an integer. This can be used to check if an object is bright enough to accurately report other visual data.
Usage:
light_sensor.brightness(units)
Παράμετρος |
Περιγραφή |
|---|---|
|
Optional. The unit to return the brightness with: |
άλλαξε#
changed registers a function to be called whenever the Light Sensor’s brightness value changes.
Usage:
light_sensor.changed(callback, arg)
Παράμετροι |
Περιγραφή |
|---|---|
|
Μια προηγουμένως καθορισμένη συνάρτηση που εκτελείται όταν αλλάζει η τιμή φωτεινότητας του αισθητήρα φωτός. |
|
Optional. A |
def my_function():
brain.screen.print("Brightness changed")
# Call my_function whenever the brightness changes
light_sensor.changed(my_function)
Κατασκευαστής#
Constructors are used to manually create Light objects, which are necessary for configuring a Light Sensor outside of VEXcode.
Light#
Light creates a Light Sensor.
Usage:
Light(port)
Παράμετρος |
Περιγραφή |
|---|---|
|
The 3-Wire Port that the Light Sensor is connected to:
|
# Create a Light Sensor in Port A
light_sensor = Light(brain.three_wire_port.a)