Επιταχυνσιόμετρο#

Εισαγωγή#

Το επιταχυνσιόμετρο μετρά την επιτάχυνση του ρομπότ κατά μήκος ενός ή περισσότερων αξόνων. Ο αισθητήρας εξάγει μια αναλογική τάση που αλλάζει με βάση την επιτάχυνση σε δυνάμεις G (G).

Ένας βραχυκυκλωτήρας στο επιταχυνσιόμετρο καθορίζει το εύρος ευαισθησίας του:

  • 2G – Μετράει την επιτάχυνση από -2G σε +2G

  • 6G – Μετράει την επιτάχυνση από -6G σε +6G

Το αναλογικό επιταχυνσιόμετρο VEX EXP.

This page uses accel_a as the example Accelerometer name. Replace it with your own configured name as needed.

Παρακάτω είναι μια λίστα με τις διαθέσιμες μεθόδους:

  • acceleration – Returns the acceleration detected by the Accelerometer in Gs.

  • changed – Registers a function to be called whenever the Accelerometer’s value changes.

Constructor – Μη αυτόματη αρχικοποίηση και ρύθμιση παραμέτρων ενός επιταχυνσιόμετρου.

επιτάχυνση#

acceleration returns the acceleration measured in Gs as a decimal float.

Usage:
accel_a.acceleration()

Παράμετροι

Περιγραφή

Αυτή η μέθοδος δεν έχει παραμέτρους.

άλλαξε#

changed registers a function to be called whenever the Accelerometer’s value changes.

Usage:
accel_a.changed(callback, arg)

Παράμετροι

Περιγραφή

callback

Μια προηγουμένως ορισμένη συνάρτηση που εκτελείται όταν αλλάζει η τιμή του επιταχυνσιόμετρου.

arg

Optional. A tuple containing arguments to pass to the callback function. See Using Functions with Parameters for more information.

def my_function():
  brain.screen.print("Value changed")

# Call my_function whenever accel_a's value changes
accel_a.changed(my_function)

Κατασκευαστής#

Constructors are used to manually create Accelerometer objects, which are necessary for configuring an Accelerometer outside of VEXcode.

Accelerometer#

Accelerometer creates an Accelerometer.

Usage:
Accelerometer(port, sensitivity)

Παράμετρος

Περιγραφή

port

The 3-Wire Port that the Accelerometer is connected to:

  • On the EXP Brainbrain.three_wire_port.x where x is the number of the port.
  • On a 3-Wire Expanderexpander.a where expander is the name of the expander instance.

sensitivity

Optional. Whether to enable high sensitivity mode on the Accelerometer: True enables high sensitivity (+/- 2g). False (default) enables low sensitivity (+/- 6g).

# Create a high sensitivity Accelerometer in Port A
accel_a = Accelerometer(brain.three_wire_port.a, True)