LED táctil#

Introducción#

El LED táctil es un botón táctil capacitivo que puede mostrar colores con distintos niveles de brillo y velocidades de transición, y puede detectar cuándo se presiona.

For the examples below, the configured Touch LED will be named touchled_1 and will be used in all subsequent examples throughout this API documentation when referring to Touchled class methods.

A continuación se muestra una lista de todos los métodos:

Acciones – Interactuar con el LED táctil.

  • pressed – Calls a function when the Touch LED is pressed.

  • released – Calls a function when the Touch LED is released.

  • on – Turns the Touch LED on.

  • off – Turns the Touch LED off.

  • toggle – Turns the Touch LED on or off.

Mutadores: cambian los colores, el brillo y la configuración del LED táctil.

  • set_color – Sets the color of the Touch LED.

  • set_fade – Sets how fast colors will fade to one another.

  • set_brightness – Sets the brightness of the Touch LED.

  • vset_blink – Alternate the Touch LED on and off indefinitely.

Obtenedores: devuelven datos del LED táctil.

  • pressing – Returns whether the Touch LED is being pressed.

  • installed – Returns whether the Touch LED is connected to the Brain.

Constructores: inicializan y configuran manualmente el LED táctil.

Comportamiento#

pressed#

pressed registers a function to be called when the Touch LED is pressed.

Usage:
touchled_1.pressed(callback, arg)

Parámetros

Descripción

callback

Una función que se define previamente para ejecutarse cuando se presiona el LED táctil.

arg

Opcional. Una tupla que contiene los argumentos que se pasarán a la función de devolución de llamada. Consulte Funciones con parámetros para obtener más información.

# Example coming soon

released#

released registers a function to be called when the Touch LED is released.

Usage:
touchled_1.released(callback, arg)

Parámetros

Descripción

callback

Una función que se define previamente para ejecutarse cuando se suelta el LED táctil.

arg

Opcional. Una tupla que contiene los argumentos que se pasarán a la función de devolución de llamada. Consulte Funciones con parámetros para obtener más información.

# Example coming soon

on#

on turns the Touch LED on by setting its brightness to 100%.

Usage:
touchled_1.on(value)

Parámetros

Descripción

value

Optional. Sets the LED’s color to:

  • Color.RED
  • Color.GREEN
  • Color.BLUE
  • Color.WHITE (default)
  • Color.YELLOW
  • Color.ORANGE
  • Color.PURPLE
  • Color.RED_VIOLET
  • Color.VIOLET
  • Color.BLUE_VIOLET
  • Color.BLUE_GREEN
  • Color.YELLOW_GREEN
  • Color.YELLOW_ORANGE
  • Color.RED_ORANGE
You can also specify a custom color.

# Example coming soon

off#

off turns the Touch LED off by setting its brightness to 0%.

Usage:
touchled_1.off()

Parámetros

Descripción

Este método no tiene parámetros.

# Example coming soon

toggle#

toggle turns the Touch LED on or off. If the LED is currently on, toggle sets its brightness to 0%, turning it off. If the LED is off, toggle sets its brightness to 100%, turning it on.

Usage:
touchled_1.toggle()

Parámetros

Descripción

Este método no tiene parámetros.

# Example coming soon

Mutadores#

set_color#

set_color sets the color of the Touch LED. If the Touch LED is not already on when this method is used, it will set the brightness to 100% to turn the Touch LED on.

Usage:
touchled_1.set_color(color)

Parámetros

Descripción

color

Optional. Sets the LED’s color to:

  • Color.RED
  • Color.GREEN
  • Color.BLUE
  • Color.WHITE (default)
  • Color.YELLOW
  • Color.ORANGE
  • Color.PURPLE
  • Color.RED_VIOLET
  • Color.VIOLET
  • Color.BLUE_VIOLET
  • Color.BLUE_GREEN
  • Color.YELLOW_GREEN
  • Color.YELLOW_ORANGE
  • Color.RED_ORANGE
If unspecified, set_color will turn the Touch LED on with the previously set color.
You can also specify a custom color.

# Example coming soon

set_fade#

set_fade changes the color fade setting for the Touch LED.

Usage:
touchled_1.set_fade(type)

Parámetros

Descripción

type

How fast a color will fade from one to the next:

  • FadeType.FAST – Colors will transition quickly.
  • FadeType.OFF – Colors will instantly transition.
  • FadeType.SLOW – Colors will transition slowly.

# Example coming soon

set_brightness#

set_brightness sets the brightness of the Touch LED.

Usage:
touchled_1.set_brightness(brightness)

Parámetros

Descripción

brightness

El brillo del LED táctil se establecerá como porcentaje.

# Example coming soon

Captadores#

pressing#

.pressing returns an integer indicating whether the Touch LED is currently being pressed.

  • 1 - The TouchLED is being pressed.

  • 0 - The TouchLED is not being pressed.

Usage:
touchled_1.pressing()

Parámetros

Descripción

Este método no tiene parámetros.

# Example coming soon

installed#

installed returns a Boolean indicating whether the Touch LED is connected to the Brain.

  • True - The Touch LED is connected to the Brain.

  • False - The Touch LED is not connected to the Brain.

Usage:
touchled_1.installed()

Parámetros

Descripción

Este método no tiene parámetros.

# Example coming soon

Constructores#

Constructors are used to manually create TouchLED objects, which are necessary for configuring a Touch LED outside of VEXcode.

TouchLED#

TouchLED creates a Touch LED.

Usage:
touchled_1 = TouchLED(port)

Parámetro

Descripción

port

Which Smart Port that the Touch LED is connected to as Ports.PORT followed by the port number, ranging from 1 to 12.

# Example coming soon