Potenciómetro#
Introducción#
El potenciómetro es un sensor analógico que mide la posición angular de un eje giratorio. Emite un voltaje proporcional a su posición.
Dependiendo de la versión del potenciómetro, la cantidad de rotación que puede detectar varía:
Potenciómetro – Hasta 250 grados
Potenciómetro V2 – 330 grados (Continuo)
|
|
|---|---|
Potenciómetro |
Potenciómetro V2 |
This page uses potentiometer_a as the example Potentiometer name. Replace it with your own configured name as needed.
A continuación se muestra una lista de los métodos disponibles:
angle– Reports the angular position of the Potentiometer in degrees or as a percent.changed– Registers a function to be called whenever the Potentiometer’s value changes.
Constructores – Inicializa manualmente un potenciómetro o un potenciómetro V2.
PotentiometerV2– Create a Potentiometer V2.Potentiometer– Create a Potentiometer.
ángulo#
angle returns the angular position of the Potentiometer.
Usage:
potentiometer_a.angle(units)
Parámetro |
Descripción |
|---|---|
unidades |
The unit of measurement:
|
cambió#
changed registers a function to be called whenever the Potentiometer’s value changes.
Usage:
changed(callback, arg)
Parámetros |
Descripción |
|---|---|
|
Una función previamente definida que se ejecuta cuando cambia el valor del potenciómetro. |
|
Opcional. Una tupla que contiene los argumentos que se pasan a la función de devolución de llamada. Consulte Funciones con parámetros para obtener más información. |
def my_function():
brain.screen.print("Value changed!")
# Call my_function whenever potentiometer_a's angle changes
potentiometer_a.changed(my_function)
Constructores#
Constructors are used to manually create PotentiometerV2 and Potentiometer objects, which are necessary for configuring Potentiometers outside of VEXcode.
PotentiometerV2#
PotentiometerV2 creates a V5 Potentiometer V2.
Usage:
PotentiometerV2(port)
Parámetro |
Descripción |
|---|---|
|
The 3-Wire Port that the Potentiometer V2 is connected to:
|
# Create a Potentiometer V2 in Port A
potentiometer_a = PotentiometerV2(brain.three_wire_port.a)
Potentiometer#
Potentiometer creates a Potentiometer.
Usage:
Potentiometer(port)
Parámetro |
Descripción |
|---|---|
|
The 3-Wire Port that the Potentiometer is connected to:
|
# Create a Potentiometer in Port A
potentiometer_a = Potentiometer(brain.three_wire_port.a)

