触摸LED#
介绍#
The Touch LED category 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 all blocks:
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.
Touch LED pressed? — Returns whether the Touch LED is currently being pressed.
when Touch LED — Executes the attached stack of blocks when the Touch LED is pressed or released.
设置触摸 LED 颜色#
设置触摸 LED 颜色 块使用当前 转换速度 和 亮度设置 设置触摸 LED 的颜色。
设定 [TouchLED 1 v] 颜色为 (none v)
参数 |
描述 |
|---|---|
触摸LED |
在设备窗口中配置要设置的触摸 LED 颜色。 |
颜色 |
Sets the LED’s color to:
|
例子
当开始
[Blink the TouchLED off and on.]
永久循环
设定 [TouchLED 1 v] 颜色为 (green v)
等待 (0.5) 秒
设定 [TouchLED 1 v] 颜色为 (none v)
等待 (0.5) 秒
当开始
[See what color the Optical Sensor is detecting.]
永久循环
设定 [TouchLED 1 v] 颜色为 ([Optical 1 v] 颜色)
等待 (0.5) 秒
设置触摸 LED 淡入淡出#
设置触摸 LED 淡入淡出 块设置触摸 LED 在颜色之间转换的速度。
设定 [TouchLED 1 v] 变色速度为 [slow v]
参数 |
描述 |
|---|---|
触摸LED |
设置触摸 LED 的转换速度,在设备窗口中配置。 |
过渡速度 |
触摸 LED 切换至下一颜色速度:
|
例子
当开始
[Slowly fade TouchLED colors.]
设定 [TouchLED 1 v] 颜色为 (green v)
设定 [TouchLED 1 v] 变色速度为 [slow v]
等待 (2) 秒
设定 [TouchLED 1 v] 颜色为 (red v)
设置触摸 LED 亮度#
设置触摸 LED 亮度块设置触摸 LED 的亮度。
设定 [TouchLED 1 v] 亮度为 (50)%
参数 |
描述 |
|---|---|
触摸LED |
在设备窗口中配置要设置的触摸 LED 亮度。 |
亮度 |
触摸 LED 的亮度从 0 到 100 的百分比。 |
例子
当开始
[Light up the TouchLED with different brightnesses.]
设定 [TouchLED 1 v] 亮度为 (25)%
设定 [TouchLED 1 v] 颜色为 (green v)
等待 (2) 秒
设定 [TouchLED 1 v] 亮度为 (100)%
触摸 LED 按下了吗?#
The Touch LED pressed? block returns a Boolean indicating if a Touch LED is currently being pressed.
True — The Touch LED is being pressed.
False — The Touch LED is not being pressed
<[TouchLED 1 v] 按下了?>
参数 |
描述 |
|---|---|
触摸LED |
要检查哪个触摸 LED,在设备窗口中配置。 |
例子
当开始
[Change the TouchLED color when it is pressed.]
设定 [TouchLED 1 v] 颜色为 (green v)
等到 <[TouchLED 1 v] 按下了?>
设定 [TouchLED 1 v] 颜色为 (blue v)
当触摸LED#
当按下或释放触摸 LED 时,当触摸 LED 块会运行附加的块堆栈。
当 [TouchLED 1 v] [pressed v]
参数 |
描述 |
|---|---|
触摸LED |
要检查哪个触摸 LED,在设备窗口中配置。 |
行动 |
确定附加的块堆栈何时执行:
|
例子
当 [TouchLED 1 v] [pressed v]
[Turn green briefly when pressed.]
设定 [TouchLED 1 v] 颜色为 (green v)
等待 [2] 秒
设定 [TouchLED 1 v] 颜色为 (none v)