LED táctil#

Introducción#

La categoría LED táctil VEX IQ (2.ª generación) ofrece métodos para interactuar con el LED táctil.

For the examples below, the configured Touch LED will be named TouchLED1 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 disponibles:

Acciones – Interactuar con el LED táctil.

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

  • released – Calls a function when the Bumper Switch is released.

  • on – Turns the Touch LED on.

  • off – Turns the Touch LED off.

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

  • setColor – Sets the color of the Touch LED.

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

  • setBrightness – Sets the brightness of the Touch LED.

  • setBlink – 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 manualmente un LED táctil.

Comportamiento#

pressed#

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

Usage:
TouchLED1.pressed(callback);

Parámetros

Descripción

callback

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

// Example coming soon

released#

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

Usage:
TouchLED1.released(callback);

Parámetros

Descripción

callback

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

// Example coming soon

on#

on method turns the LED of the TouchLED Sensor on using predefined colors and a set brightness.

Default Usage:
TouchLED1.on(color, brightness);

Overload Usages:
TouchLED1.on(hue, brightness);
TouchLED1.on(r, g, b, brightness);

Parámetros

Descripción

color

A valid color:

  • blue
  • blue_green
  • blue_violet
  • green
  • orange
  • purple
  • red
  • red_orange
  • red_violet
  • violet
  • white
  • yellow
  • yellow_green
  • yellow_orange
  • colorType::none
  • black
  • transparent

brightness

Opcional. El brillo al que se configurará el LED en porcentaje, con un valor predeterminado de 100.

hue

El tono del LED. También se puede representar como un valor hexadecimal.

r

Un número entero que representa el valor rojo del LED.

g

Un número entero que representa el valor verde del LED.

b

Un número entero que representa el valor azul del LED.

// Example coming soon

off#

off turns the Touch LED off.

Usage:
TouchLED1.off();

Parámetros

Descripción

Este método no tiene parámetros.

// Example coming soon

Mutadores#

setColor#

setColor turns the LED of the Touch LED Sensor on to a specific color.

Usage:
TouchLED1.setColor(color);

Parámetros

Descripción

color

A valid color:

  • blue
  • blue_green
  • blue_violet
  • green
  • orange
  • purple
  • red
  • red_orange
  • red_violet
  • violet
  • white
  • yellow
  • yellow_green
  • yellow_orange
  • colorType::none
  • black
  • transparent
// Example coming soon

setFade#

setFade changes the fade setting of the Touch LED Sensor. The Touch LED Sensor will change to new colors using the fade type.

Usage:
TouchLED1.setFade(speed);

Parámetros

Descripción

speed

The speed the fade will be set to:

  • fast
  • off — no fade
  • slow
// Example coming soon

setBrightness#

setBrightness sets the brightness of the Touch LED.

Usage:
TouchLED1.setBrightness(value);

Parámetros

Descripción

value

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

// Example coming soon

Captadores#

pressing#

pressing returns a Boolean indicating whether the Touch LED Sensor is currently being pressed.

  • 1 – The Touch LED is currently bring pressed.

  • 0 – The Touch LED is not currently being pressed.

Usage:
TouchLED1.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 currently connected to the Brain.

  • 1 – The TouchLED is connected to the Brain.

  • 0 – The TouchLED is not connected to the Brain.

Usage:
TouchLED1.installed()

Parámetros

Descripción

Este método no tiene parámetros.

// Example coming soon

Constructores#

touchled#

touchled creates an object of the touchled Class in the specified port.

Usage:
touchled TouchLED1 = touchled(port);

Parámetro

Descripción

port

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

// Example coming soon