Touch LED#
Introduction#
The Touch LED includes blocks that control and monitor the VEX IQ (2nd gen) Touch LED. These blocks allow you to set color, brightness, and fade speed, as well as detect when the Touch LED is being pressed.
Below is a list of available blocks:
Looks – Control color and display properties.
set Touch LED color – Sets the Touch LED to a selected color.
set Touch LED fade – Sets how quickly the Touch LED transitions between colors.
set Touch LED brightness – Sets the brightness level of the Touch LED.
Sensing – Detect user interaction.
Touch LED pressed? – Returns whether the Touch LED is currently being pressed.
Looks#
set Touch LED color#
The set Touch LED color block sets the color of the Touch LED using the current transition speed and brightness settings.
set [TouchLED1 v] color to (none v)
Parameters |
Description |
---|---|
touch led |
Which Touch LED’s color to set, configured in the Devices window. |
color |
Sets the LED’s color to:
|
Example
when started :: hat events
set [TouchLED11 v] color to (green v)
wait (2) seconds
set [TouchLED11 v] color to (none v)
set Touch LED fade#
The set Touch LED fade block sets how fast the Touch LED will transition between colors.
set [TouchLED1 v] fade to [slow v]
Parameters |
Description |
---|---|
touch led |
Which Touch LED’s transition speed to set, configured in the Devices window. |
transition speed |
The speed at which the Touch LED will transition to the next color:
|
Example
when started :: hat events
set [TouchLED11 v] color to (green v)
set [TouchLED11 v] fade to [slow v]
wait (2) seconds
set [TouchLED11 v] color to (red v)
set Touch LED brightness#
The set Touch LED brightness block sets the brightness of the Touch LED.
set [TouchLED1 v] brightness to (50) %
Parameters |
Description |
---|---|
touch led |
Which Touch LED’s brightness to set, configured in the Devices window. |
brightness |
The brightness of the Touch LED from 0 to 100 as a percent. |
Example
when started :: hat events
set [TouchLED11 v] brightness to (25) %
set [TouchLED11 v] color to (green v)
wait (2) seconds
set [TouchLED11 v] brightness to (100) %
Sensing#
Touch LED pressed?#
The Touch LED pressed? block returns if a Touch LED is currently being pressed or not pressed. This block returns a Boolean value:
True - The Touch LED is being pressed.
False - The Touch LED is not being pressed
<[TouchLED1 v] pressed?>
Parameters |
Description |
---|---|
touch led |
Which Touch LED to check, configured in the Devices window. |
Example
when started :: hat events
[Don't print the message until the Touch LED Sensor is pressed.]
wait until <[TouchLED11 v] pressed?>
print [Touch LED was pressed.] on [Brain v] ◀ and set cursor to next row