Using the VEX IQ Touch LED

Description

This sensor can detect capacitive touch, such as the touch of a finger. It can also be set to display many colors.

Diagram illustrating VEX IQ sensors, showcasing various types and their functions within the VEX IQ Robotics platform, aimed at enhancing educational robotics experiences for beginners and educators.

The VEX IQ Touch LED Sensor is included in the VEX IQ Super Kit but it can also be purchased here.


How the Touch LED Works: Detecting Touches

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system, aimed at educational purposes for beginner robotics enthusiasts.

The Touch LED uses technology that detects small changes in the physical properties of its surroundings. It does this by measuring capacitance.

Capacitance is a physical property of any object. It can be affected by what a thing is made of, or what it's shaped like. The air around us has a certain capacitance, an electrical circuit has a certain capacitance, and your body has a certain capacitance.

The Touch LED can detect this capacitance by sending an electrical signal and noting what comes back. In the image you can see that when the button is pressed, the purple response signal changes compared to the blue input signal. If the response signal is just right, it means there is a finger present, and the Touch LED sends a message back to the Robot Brain which means that it's being touched.

One advantage of checking for touch in this way is that a change in capacitance does not require that you touch the circuit directly, only that you get very close. As a result, the electronics in the Touch LED can be shielded with plastic and packaged along with more electronics, like the multi-color LEDs inside the device.


Common Uses of the Touch LED:

  • This sensor can be used to start or pause a program at the touch of a finger.

  • This sensor can be used to display different colors at different parts of a program.


Uses of the Touch LED on a Competition Robot:

  • The Touch LED can be used to start a running program with a finger press.
  • Team members can see when different sections of an autonomous program are running by programming the Touch LED to display a unique color for each section.
  • Using the Touch LED can also be used to help troubleshoot programming problems if issues occur.

Using the Touch LED in VEXcode IQ

Adding the Touch LED as a Device in VEXcode IQ

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections, relevant for educational purposes and beginner robotics enthusiasts.

To code the Touch LED in a VEXcode IQ, you must first configure the Touch LED. View this article to learn more about configuring a sensor in VEXcode IQ.

Once the Touch LED is configured, commands will appear in the Toolbox that you can use in your project.

Coding the Touch LED in Blocks

Pressing Touch LED

Diagram illustrating various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections within the system, aimed at enhancing educational robotics experiences for beginners and educators.

The <Pressing Touch LED> block is a Boolean reporter block that reports a condition as either true or false. Boolean blocks, like the <Pressing Touch LED> block fit inside blocks with hexagonal (six-sided) inputs for other blocks.

The <Pressing Touch LED> Boolean block reports 'true' if the Touch LED is pressed, and 'false' if the Touch LED is released or not pressed. To learn more about Boolean blocks visit the Help or the Block Shapes and Meaning article.

Note: The name of the Touch LED that appears in the command corresponds to the name it is given in the configuration. 

Illustration of VEX IQ sensors, showcasing various types and their applications in robotics, highlighting educational resources for beginners and educators in the VEX IQ platform.

In this example, the <Pressing Touch LED> block is used with a [Wait until] block to make the robot drive forward for 500mm when the Touch LED is pressed, as shown in the video above. 

{When Touch LED}

Diagram showing various sensors used in the VEX IQ Robotics platform, illustrating their placement and functionality for educational robotics projects.

The <Pressing Touch LED> block is an Event block that will run the stack of blocks attached when the Touch LED is pressed or released. 

To learn more about Event blocks visit the Help or the Block Shapes and Meaning article.

Diagram illustrating various sensors used in the VEX IQ Robotics platform, showcasing their placement and functions to enhance robot performance in educational robotics projects.

In this example, the {When Touch LED} block is used with a [Drive for] block to make the robot drive forward 500 until the Touch LED is pressed, as shown in the video above. 

Touch LED Blocks in the Look Category

Diagram illustrating the various sensors used in the VEX IQ Robotics platform, highlighting their functions and connections to enhance educational robotics projects for beginners and educators.

Each of these blocks can be used to adjust the color shown on the Touch LED. 

[Set Touch LED color] is used to set the desired color of the Touch LED. 

[Set Touch LED fade] is used to set the desired speed of the fade of the Touch LED to slow, fast, or none. 

[Set Touch LED brightness] is used to set the desired brightness level of the Touch LED from 0-100%. 

To learn more about each of these blocks visit the Help.

Diagram illustrating the various sensors available for the VEX IQ Robotics platform, highlighting their functions and connections within the system, aimed at enhancing educational robotics projects for beginners and educators.

In this example, the Touch LED brightness is set to 100% and the color will first show blue for 2 seconds then slowly fade to red. These blocks can be used to display different colors at different parts of a project.

Coding the Touch LED in Python

Note: To code an VEX IQ (1st generation) Bumper Switch in Python, it must be connected to a VEX IQ (2nd generation) Brain. The VEX IQ (1st generation) Brain does not support Python.

TouchLED.pressing

touchled_3.pressing()

The TouchLED.pressing command reports a Boolean value of either true or false about the Touch LED.

The TouchLED.pressing command reports 'true' if the Touch LED is pressed, and 'false' if the Touch LED is released or not pressed. 

Note: The name of the Touch LED that appears in the command corresponds to the name it is given in the configuration. 

Touch LED Event Commands

touchled_3.pressed(callback)
touchled_3.released(callback)

The TouchLED.pressed and TouchLED.released commands runs a specified callback function when the Touch LED is pressed or released.

Touch LED Commands in the Looks Category

touchled_3.set_color(Color.BLACK)
touchled_3.set_fade(FadeType.SLOW)
touchled_3.setbrightness(50)

Each of these commands can be used to adjust the color shown on the Touch LED. 

Set TouchLED color is used to set the desired color of the Touch LED. 

Set TouchLED fade  is used to set the desired speed of the fade of the Touch LED to slow, fast, or none. 

Set TouchLED brightness  is used to set the desired brightness level of the Touch LED from 0-100%. 

To learn more about each of these commands visit the Help.

For more information, help, and tips, check out the many resources at VEX Professional Development Plus

Last Updated: